0
我不熟悉在Apple Watch中的兩個WKInterfaceController
之間傳輸或傳遞數據。我想要做的是,我有一些像name
和age
SecondInterfaceController
這樣的變量,所以當用戶點擊一行時,我需要從WKInterfaceTable
傳遞一些值給他們。這裏是代碼:將數據從WKInterfaceTable傳輸到另一個WKInterfaceController
- (void)table:(WKInterfaceTable *)table didSelectRowAtIndex:(NSInteger)rowIndex {
NSString *name;
NSString *age;
switch (rowIndex) {
case 0:
name = @"Jack";
age = @"22";
break;
default:
break;
}
NSDictionary *d = [NSDictionary dictionaryWithObject:name forKey:@"kName"];
[self pushControllerWithName:@"SecondInterfaceController" context:d];
}
,但我不知道我怎樣才能獲得從SecondIntefaceController字典,並把它傳遞給_name(WKInterfaceLable)。
謝謝!但通過不同的字典呢!如果添加'dinoDict = [NSDictionary dictionaryWithObject:age forKey:@「kAge」];'只有一個字典會被傳遞,我怎樣才能將多個值附加到一個上下文中? –
@ Mc.Lover我在我的答案中添加了一些代碼,以顯示如何在字典中傳遞多個值 – dan