此应用程序是我使用UITableView的第一个应用程序,我遇到了为什么要向其添加详细信息视图的问题。 (因为我第一次创建它时我的应用程序是“基于视图的应用程序”,所以我必须手动执行此操作)。将详细信息视图添加到UITableView
这是我的表视图的didSelectRowAtIndexPath:
代码:
detail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle: [NSBundle mainBundle]];
detail.delegate = self;
detail.dtitle = [titles objectAtIndex: indexPath.row];
detail.dusername = [usernames objectAtIndex: indexPath.row];
detail.dpassword = [passwords objectAtIndex: indexPath.row];
[self.navigationController pushViewController: detail animated:YES];
//[self presentViewController:detail animated:NO completion:nil];
倒数第二行是一个引起问题。我从我制作的一个空白的“主 - 细节应用程序”中复制它,但它似乎不适用于此应用程序,因为它在另一个应用程序中。注释掉的线是我一直在使用的地方,但并不完全是我想要的。
我能做些什么来解决这个问题?
其次,在DetailViewController
,在我的标题栏中的后退按钮(导航栏的导航项目,要准确)就不会出现。我是否需要添加代码来表明此视图是从属视图还是其他内容?
如果有人绊倒在这里,这里有这个答案的具体代码:http://stackoverflow.com/questions/11341337/embed-navigation-controller – Greg