我创建了一个ipad应用程序,其中第一个屏幕是拆分视图。在该主视图中是表视图,而详细视图包含图像视图控制器。我的问题是,当最初的应用程序被加载时,表格视图的第一个单元格应该被视为已选中,相应的图像视图应该出现在详细视图中。
答案 0 :(得分:0)
您似乎不需要将单元格视为已选中,但您需要选择该单元格(以显示相应的图像)
你应该看到这篇文章How do I select a UITableViewCell by default?
以下是示例代码
-(void)viewDidLoad:(BOOL)animated {
[uiTableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:0];
}
或者如果您确实希望使单元格看起来像选中,您可以执行类似
的操作-(void)viewDidLoad:(BOOL)animated {
UITableViewCell *cell= [uiTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
[cell setHighlighted:TRUE animated:TRUE];
}