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

后端 未结 9 1064
执笔经年
执笔经年 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 13:12

    I was having a similar problem where the scroll-to-top functionality was lost. Turns out this will only work when you have only one active view at a time (within the same scroll view). In my case I had a table view and another view which would fade in/out. Adding a removeFromSuperview at the end of the animation did the trick.

    The answer was in the UIScrollView.h file comments:

    /*
     this is for the scroll to top gesture. by default, a single scroll visible scroll view with this flag set will get the call. if there is more than one visible with this
     flag set or the delegeat method returns NO, the view isn't scrolled 
     */
    @property(nonatomic) BOOL  scrollsToTop;          // default is YES. if set, special gesture will scroll to top of view after consulting delegate
    

提交回复
热议问题