[ios] Use presentModalViewController[] and dismissModalViewController[] to transition between SearchVC and ArticleVC and remove reference to SearchVC from ArticleVC.

This commit is contained in:
Yury Melnichek 2011-04-05 16:50:06 +02:00 committed by Alex Zolotarev
parent 5843f5324c
commit e1445f8694
3 changed files with 6 additions and 28 deletions

View file

@ -3,7 +3,6 @@
@interface ArticleVC : UIViewController
<UINavigationBarDelegate, UIWebViewDelegate, UIGestureRecognizerDelegate>
{
UIViewController * searchVC; // Search controller.
UIWebView * webView; // Web view that displays an article.
UINavigationBar * navBar; // Navigation bar.
UINavigationItem * navSearch;
@ -15,7 +14,6 @@
double m_fontScaleOnPinchStart;
}
@property (nonatomic, assign) UIViewController * searchVC; // "assign" to avoid circular references.
@property (nonatomic, retain) UIWebView * webView;
@property (nonatomic, retain) UINavigationBar * navBar;
@property (nonatomic, retain) UINavigationItem * navSearch;

View file

@ -8,7 +8,6 @@
@implementation ArticleVC
@synthesize searchVC;
@synthesize webView;
@synthesize navBar;
@synthesize navSearch;
@ -17,7 +16,6 @@
- (void)dealloc
{
self.searchVC = nil;
self.webView = nil;
self.navBar = nil;
self.navSearch = nil;
@ -114,15 +112,6 @@
UIView * superView = self.view.superview;
[searchVC viewWillAppear:YES];
[self viewWillDisappear:YES];
[self.view removeFromSuperview];
[superView addSubview:self.searchVC.view];
[self viewDidDisappear:YES];
[searchVC viewDidAppear:YES];
CATransition * animation = [CATransition animation];
animation.duration = 0.2;
animation.type = kCATransitionPush;
@ -131,7 +120,8 @@
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[[superView layer] addAnimation:animation forKey:@"SwitchToSearchView"];
self.searchVC = nil;
[self dismissModalViewControllerAnimated:NO];
return NO;
}

View file

@ -163,25 +163,15 @@ struct SloynikData
{
[self.resultsView deselectRowAtIndexPath:[self.resultsView indexPathForSelectedRow] animated:NO];
self.articleVC.searchVC = self;
UIView * superView = self.view.superview;
[self.articleVC viewWillAppear:YES];
[self viewWillDisappear:YES];
[self.view removeFromSuperview];
[superView addSubview:[self.articleVC view]];
[self viewDidDisappear:YES];
[self.articleVC viewDidAppear:YES];
CATransition * animation = [CATransition animation];
animation.duration = 0.2;
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromRight;
animation.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[[superView layer] addAnimation:animation forKey:@"SwitchToArticleView"];
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[[self.view.superview layer] addAnimation:animation forKey:@"SwitchToArticleView"];
[self presentModalViewController:self.articleVC animated:NO];
}
- (void)onEmptySearch