diff --git a/iphone/Maps/Classes/GuideViewController.mm b/iphone/Maps/Classes/GuideViewController.mm index 6e4dddd590..f6602f6db0 100644 --- a/iphone/Maps/Classes/GuideViewController.mm +++ b/iphone/Maps/Classes/GuideViewController.mm @@ -60,10 +60,10 @@ // Do nothing. Don't hide the results view. } -- (void)willShowArticleVC:(ArticleVC *) articleVC +- (void)willShowArticleVC:(ArticleVC *) viewController { - [super willShowArticleVC:articleVC]; - articleVC.articleFormat = @ + [super willShowArticleVC:viewController]; + viewController.articleFormat = @ "" " " " " diff --git a/iphone/Sloynik/Shared/ArticleVC.h b/iphone/Sloynik/Shared/ArticleVC.h index caff566747..70a02d5a59 100644 --- a/iphone/Sloynik/Shared/ArticleVC.h +++ b/iphone/Sloynik/Shared/ArticleVC.h @@ -13,6 +13,8 @@ unsigned int m_articleId; double m_fontScale; double m_fontScaleOnPinchStart; + /// used for transition + UIView * previousView; } @property (nonatomic, retain) UIWebView * webView; @@ -21,8 +23,9 @@ @property (nonatomic, retain) UINavigationItem * navArticle; @property (nonatomic, retain) UIPinchGestureRecognizer * pinchGestureRecognizer; @property (nonatomic, retain) NSString * articleFormat; +@property (nonatomic, assign) UIView * previousView; -- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle; +- (id)initWithPreviousView:(UIView *)previousView; - (void)setArticleById:(unsigned int)articleId; @end diff --git a/iphone/Sloynik/Shared/ArticleVC.mm b/iphone/Sloynik/Shared/ArticleVC.mm index 71c7e2b340..d3d958f30d 100644 --- a/iphone/Sloynik/Shared/ArticleVC.mm +++ b/iphone/Sloynik/Shared/ArticleVC.mm @@ -14,6 +14,7 @@ @synthesize navArticle; @synthesize pinchGestureRecognizer; @synthesize articleFormat; +@synthesize previousView; - (void)dealloc { @@ -26,11 +27,12 @@ [super dealloc]; } -- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle +- (id)initWithPreviousView:(UIView *)prevView { if ((self = [super initWithNibName:nil bundle:nil])) { self.articleFormat = @"%@"; + self.previousView = prevView; } return self; } @@ -137,7 +139,11 @@ animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; [[superView layer] addAnimation:animation forKey:@"SwitchToSearchView"]; - [self dismissModalViewControllerAnimated:NO]; + [UIView transitionFromView:self.view + toView:self.previousView + duration:0 + options:UIViewAnimationOptionTransitionNone + completion:nil]; return NO; } diff --git a/iphone/Sloynik/Shared/SearchVC.h b/iphone/Sloynik/Shared/SearchVC.h index d012a51e9f..ea641ccd97 100644 --- a/iphone/Sloynik/Shared/SearchVC.h +++ b/iphone/Sloynik/Shared/SearchVC.h @@ -10,10 +10,12 @@ typedef struct SloynikData SloynikData; SloynikData * m_pSloynikData; UISearchBar * searchBar; UITableView * resultsView; + ArticleVC * articleVC; } @property (nonatomic, retain) IBOutlet UISearchBar * searchBar; @property (nonatomic, retain) IBOutlet UITableView * resultsView; +@property (nonatomic, retain) ArticleVC * articleVC; - (void)willShowArticleVC:(ArticleVC *) articleVC; - (void)onEmptySearch; diff --git a/iphone/Sloynik/Shared/SearchVC.mm b/iphone/Sloynik/Shared/SearchVC.mm index 5ca546e696..1be002d5a1 100644 --- a/iphone/Sloynik/Shared/SearchVC.mm +++ b/iphone/Sloynik/Shared/SearchVC.mm @@ -24,12 +24,14 @@ struct SloynikData @synthesize searchBar; @synthesize resultsView; +@synthesize articleVC; - (void)dealloc { delete m_pSloynikData; [searchBar release]; [resultsView release]; + [articleVC release]; [super dealloc]; } @@ -47,6 +49,8 @@ struct SloynikData m_pSloynikData = new SloynikData; GetSloynikEngine()->Search("", m_pSloynikData->m_SearchResult); + self.articleVC = [[ArticleVC alloc] initWithPreviousView:self.view]; + [self onEmptySearch]; } @@ -64,6 +68,7 @@ struct SloynikData // e.g. self.myOutlet = nil; self.searchBar = nil; self.resultsView = nil; + self.articleVC = nil; } - (void)searchBar:(UISearchBar *)sender textDidChange:(NSString *)searchText @@ -145,7 +150,6 @@ struct SloynikData sl::SloynikEngine::WordId const wordId = indexPath.row; if (wordId < GetSloynikEngine()->WordCount()) { - ArticleVC * articleVC = [[[ArticleVC alloc] initWithNibName:nil bundle:nil] autorelease]; [self willShowArticleVC:articleVC]; [articleVC setArticleById:wordId]; @@ -166,7 +170,11 @@ struct SloynikData animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; [[self.view.superview layer] addAnimation:animation forKey:@"SwitchToArticleView"]; - [self presentModalViewController:articleVC animated:NO]; + [UIView transitionFromView:self.view + toView:articleVC.view + duration:0 + options:UIViewAnimationOptionTransitionNone + completion:nil]; } }