我已經看過,但還沒有找到合理的答案。我有一個第一個TableViewController
,保存,可以說4行,當用戶點擊一行(導航層次結構),我想傳遞給第二個tableViewController
一個字符串或一個int,將確定哪些數據第二個tableViewController
應該顯示/加載在第二張桌子上。我會怎麼做?如何將字符串從一個tableViewController傳遞到使用導航的其他tableViewController
我使用的Xcode 4.2,使用ARC,但不使用故事板。
更新:
OK,讓我們看看,如果我得到了它。 在我secondVC,我將在第一視圖控制器不
--
.h --
@property(nonatomic, strong) NSString *strReceived; --
.m --
@syntesize strReceived; --
我將做到:
--
.h --
@property (nonatomic, strong) SecondViewController *secondViewController --
.m --
@syntesize secondViewController --
,然後,在該方法didSelectRowAtIndexPath方法我將做到:
--
if(indexPath.row == 1) --
self.secondViewController.strReceived = @"one"; --
else --
self.secondViewController.strReceived = @"other";
是那對嗎?因爲用戶可能會返回並選擇另一行,我的字符串是否需要爲NSMutableString
?