有一种方法可以获得通知,回调或一些其他方法来调用一个方法,每当UIView变得可见的用户,即当UIScrollview是一些UIViews的超视图,并且这样的UIView的ViewController
Is there a way to get a notification, a callback or some other means to call a method whenever a UIView becomes visible for the user, i.e. when a UIScrollview is the superview of some UIViews, and the ViewController of such a UIView shall get notified when its view is now visible to the user?
我知道可能的,但不是那么优雅的解决方案,检查ScrollView滚动到哪个位置(通过UIScrollViewDelegate方法),并计算任何一个子视图是否可见... 但是我正在寻找一个更通用的方法来做这个。
I am aware of the possible, but not so elegant solution of checking to which position the ScrollView scrolled (via UIScrollViewDelegate-methods) and compute if either one of the subviews is visible... But I'm looking for a more universal way of doing this.
推荐答案如果你的视图是展示行为,它应该在视图控制器中。在视图控制器上,每次视图出现时将调用viewDidAppear方法。
If your view is exhibiting behavior, it should be within a view controller. On a view controller, the viewDidAppear method will be called each time the view appears.
- (void)viewDidAppear:(BOOL)animated更多推荐
当UIView可见时,如何获得通知?
发布评论