2015-05-14 65 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位置: