我可以正确调用“toggleMasterVisible”方法作为按钮操作,但我想像这样扩展该方法。
(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];
}
}
但是,我收到一个错误,即“没有可见的 @interface for 'UISplitViewController' 声明”。方法在哪里定义?我在参考上找不到方法(http://developer.apple.com/library/ios/#documentation/uikit/reference/UISplitViewController_class/Reference/Reference.html),我该如何调用该方法?任何帮助将不胜感激。