我正在使用代理UITabbarController
,其转换动画如下:
-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
NSArray *tabViewControllers = tabBarController.viewControllers;
UIView * fromView = tabBarController.selectedViewController.view;
UIView * toView = viewController.view;
if (fromView == toView)
return TRUE;
NSUInteger fromIndex = [tabViewControllers indexOfObject:tabBarController.selectedViewController];
NSUInteger toIndex = [tabViewControllers indexOfObject:viewController];
[UIView transitionFromView:fromView
toView:toView
duration:0.3
options: toIndex > fromIndex ? UIViewAnimationOptionTransitionFlipFromLeft : UIViewAnimationOptionTransitionFlipFromRight
completion:^(BOOL finished) {
if (finished) {
tabBarController.selectedIndex = toIndex;
}
}];
return true;
}
只有这会打破我对视图的整个ViewDidAppear
。我在切换选项卡时将UIWebView
重置为主页,但这不再起作用。有什么建议?这是我的VieDidLoad
:
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
_progressProxy = [[NJKWebViewProgress alloc] init];
_webView.delegate = _progressProxy;
_progressProxy.webViewProxyDelegate = self;
_progressProxy.progressDelegate = self;
[self loadSite];
[TestFlight passCheckpoint:@"Bekijkt homepage"];
}
[self loadSite];
定义为:
-(void)loadSite
{
NSString *dealerurl = [[NSUserDefaults standardUserDefaults] stringForKey:@"name_preference"];
NSString *urlAddress= @"http://www.sportdirect.com/shop/";
NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlAddress]];
[_webView loadRequest:req];
[[_webView scrollView] setBounces: NO];
}
提前致谢。
答案 0 :(得分:1)
变化:
[_webView loadRequest:req];
到此:
self.webView loadRequest:req;
我认为这会撤消nil
。