0
使用以下代碼,我將數據發送到視圖控制器,然後根據我發送的ID變量檢索另一組數據。如何將變量傳遞給TabviewController?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *dict = [rows objectAtIndex: indexPath.row];
ListingsViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"tabView"];
controller.SUBSUBCATNAME = [dict objectForKey:@"S_NAME_EN"];
controller.SUBSUBCATNUMBER = [dict objectForKey:@"SUBCAT_ID"];
[self.navigationController pushViewController:controller animated:YES];
}
下一個視圖加載另一個表,列出一個國家的酒店。我想要做的就是在tab選項卡之間放置一個tab選項,並在選項卡的幫助下過濾酒店。例如,第一個標籤會顯示所有酒店,第二個標籤會顯示一個地區的酒店,第三個標籤顯示另一個地區等。
我的問題是,當我送SUBSUBCATNUMBER到tabbarcontroller,它拋出一個錯誤:
'NSInvalidArgumentException', reason: '-[tabView setSUBSUBCATNUMBER:]: unrecognized selector sent to instance
我怎麼能這個ID發送給它加載,列出該ID的類別的所有目錄我的視圖控制器的tabbarcontroller。
歐文謝謝。顯然這是一個字母大小寫問題。現在我已經把它變成了小寫字母,錯誤消失了。但該變量不會傳遞給tabviewcontroller的初始視圖控制器。你認爲我應該創建tabviewcontroller語法來克服這個問題? –
你在使用@property嗎?你應該有:@ property(nonatomic,retain)NSString * subSubCatNumber;和@合成subSubCatNumber在您的ListingsViewController代碼中的正確位置,以及dealyoc中的self.subSubCatNumber = nil(如果您不使用ARC)。如果你不熟悉它們,你應該閱讀使用@屬性,@綜合。 –