-2

我正在使用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];
}

提前致谢。

4

1 回答 1

1

改变:

[_webView loadRequest:req];

对此:

self.webView loadRequest:req;

我认为这将撤消nil.

于 2013-11-01T10:26:54.137 回答