2015-05-14 63 views
2

我有一个WKInterfaceController,我添加了一个表如下:WKInterfaceTable的didSelectRowAtIndex不会被调用在WKInterfaceController

// .h 

@interface InterfaceController : WKInterfaceController 
@property (weak, nonatomic) IBOutlet WKInterfaceTable *table; 
@end 

// .m 
- (void)table:(WKInterfaceTable *)table didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
    NSLog(@"did select"); 
} 

- (void)table:(WKInterfaceTable *)table 
didSelectRowAtIndex:(NSInteger)rowIndex{ 
    NSLog(@"did select new"); 
} 

然而无论这两种方法被调用。我无法找到WKInterfaceTable的任何协议声明,也无法找到表上的任何委托属性。

有什么,我在这里失踪?

回答

5

我发现该方法从来没有被调用过,因为我在界面构建器上选择了行时设置了触发器。

看来,通过一旦设置了委托就没有委派和表协议,它就会停止调用didSelectRow方法。

3

在苹果的WKInterfaceController的文件中说,如果你没有任何动作或塞格斯则调用的方法是: - 表:didSelectRowAtIndex:

如果使用塞格斯则调用的方法是:

对于按钮: - contextForSegueWithIdentifier:

对于表: - contextForSegueWithIdentifier:于表:rowIndex位置: