UISplitViewController toggleMasterVisible method. Where is the method defined?

≯℡__Kan透↙ 提交于 2019-12-11 05:50:36

问题


I can call properly "toggleMasterVisible" method as a Button action but I want to expand the method like this.

(In Button action. It works)
.h 
@interface DetailViewController : UIViewController <UISplitViewControllerDelegate>
@end

.m
UIBarButtonItem *listBarButtonItem = [[UIBarButtonItem alloc] 
initWithImage:[UIImage imageNamed:@"list.png"] 
style:UIBarButtonItemStyleBordered 
target:self.splitViewController 
action:@selector(toggleMasterVisible:)];


(I want to expand the method)
.m
UIBarButtonItem *listBarButtonItem = [[UIBarButtonItem alloc] 
initWithImage:[UIImage imageNamed:@"list.png"] 
style:UIBarButtonItemStyleBordered 
target:self 
action:@selector(toggleMasterVisibleIfCondtionIsOK:)];

-(void)toggleMasterVisibleIfCondtionIsOK
{
     if(isConditionOK){
          [self.splitViewController toggleMasterVisible];
     }
}

However, I got an error which is "No visible @interface for 'UISplitViewController' declares". Where is the method defined? I could not find the method on the reference(http://developer.apple.com/library/ios/#documentation/uikit/reference/UISplitViewController_class/Reference/Reference.html) and how can I call the method? Any help will be appreciated.


回答1:


I got it to work with:

[self.splitViewController performSelector:@selector(toggleMasterVisible:)];


来源:https://stackoverflow.com/questions/14581411/uisplitviewcontroller-togglemastervisible-method-where-is-the-method-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!