我有一个表格视图,基本上只有 2 行,添加类别和删除类别。在选择让我们说添加类别时,我想加载添加类别视图,对于删除类别也类似。我将如何去做,因为 if 语句没有帮助。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *selectedCategory = [functionName objectAtIndex:[indexPath row]];
KeyCryptAppAppDelegate *appDelegate = (KeyCryptAppAppDelegate *)[[UIApplication sharedApplication] delegate];
if (selectedCategory = @"Add Category")
{
addCategoryView = [[AddCategoryView alloc]initWithNibName:@"AddCategoryView" bundle:nil];
[appDelegate.categoryNavController pushViewController:addCategoryView animated:YES];
}
if (selectedCategory = @"Delete Category")
{
deleteCategoryView = [[DeleteCategoryView alloc]initWithNibName:@"DeleteCategoryView" bundle:nil];
[appDelegate.categoryNavController pushViewController:deleteCategoryView animated:YES];
}}
此代码将使添加类别视图出现在两个详细视图中,而不是正确的视图中。请指教!
谢谢!
[编辑]