[英]Is there a way for the Top View Controller in ECSlidingViewController to know when the sidebar menu has been dismissed?
Is there a way for the Top View Controller in ECSlidingViewController to know when the sidebar menu has been dismissed, or when it is about to become the focus? ECSlidingViewController中的“顶视图控制器”是否有办法知道何时关闭侧边栏菜单或何时将其变为焦点? ie a sort of viewWillAppear equivalent for ECSlidingViewController. 即,一种等效于ECSlidingViewController的viewWillAppear。 I have a refreshcontrol in my top view controller that starts misbehaving after the sidebar is shown, so I am trying to figure out where I can call endRefreshing on the refreshControl so that the wierdness goes away. 我的顶视图控制器中有一个refreshcontrol,在显示侧边栏后它开始出现异常,因此我试图找出在refreshControl上可以在何处调用endRefreshing的方法,以便消除烦恼。 Putting it in viewWillAppear doesn't work. 将其放在viewWillAppear中不起作用。 Thanks! 谢谢!
Since ECSlidingViewController v2.0 does not have notifications, I was able to solve this in the following way. 由于ECSlidingViewController v2.0没有通知,因此我可以通过以下方式解决此问题。 In the sidebar menu, in ViewWillDisappear I call a new category method on UIViewController called "willGetFocus." 在侧边栏菜单中的ViewWillDisappear中,我在UIViewController上调用了一个新的类别方法,称为“ willGetFocus”。 Whenever my topViewController needs to know when it's about to get focus I override willGetFocus in that view Controller like so: 每当我的topViewController需要知道何时要获得焦点时,我都会在该View Controller中覆盖willGetFocus,如下所示:
In sidebar menu: 在侧边栏菜单中:
-(void) viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
UINavigationController* topViewController =
((UINavigationController*)self.slidingViewController.topViewController);
[topViewController.visibleViewController willGetFocus];
}
In Top View Controller: 在顶视图控制器中:
-(void) willGetFocus {
[self.refreshControl endRefreshing];
}
New Category: 新类别:
@interface UIViewController (KnowsFocus)
-(void) willGetFocus;
@end
@implementation UIViewController (KnowsFocus)
-(void) willGetFocus {
}
@end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.