我想創建一個方法,將字符串對象「tableColorName」更改爲所選單元格。 tableData NSArray
由對象組成:「紅色」,「藍色」,「綠色」。如果選擇了紅色,我想將字符串「tableColorName」保存爲redColor
,如果是藍色,則保存爲blueColor
,如果是綠色,則保存爲greenColor
。選中單元格後,我想讓viewController回到根目錄。我感謝您的幫助提前:在表IOS中選擇單元格
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int theRow = indexPath.row;
NSString *tableColorName;
tableColorName = [[NSString alloc] initWithString:([_tableData [theRow] stringValue],@"Color")];
[self.navigationController popToRootViewControllerAnimated:YES];
}
你能告訴我們'cellForRowAtIndexPath'方法 – 2013-03-15 03:17:02