iPhone OS: Tap status bar to scroll to top doesn't work after remove/add back

后端 未结 9 1048
执笔经年
执笔经年 2020-12-05 12:30

Using this method to hide the status bar:

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];

When setting \"hidden\"

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 12:54

    I want to add my case, I add an UIWebView on an UIScrollView, as h4xxr had answered on the top:

    If there is more than one scrolling view a scrollViewDidScrollToTop message is ignored

    So, I get a simply way to make it work on webView: just set the scrollView·s scrollsToTop property false.

    And when tap the status bar, it won`t got intercepted by the scrollView, and the webView scrolls to the top!

        UIScrollView *scrollView = [[UIScrollView alloc] init];
        scrollView.frame = self.view.bounds;
        scrollView.scrollsToTop = false; //igore scrollView`s scrollsToTop
        [self.view addSubview:scrollView];
    
        UIWebView *webView = [[UIWebView alloc] init];
        webView.frame = scrollView.bounds;
        [scrollView addSubview:webView];
    

提交回复
热议问题