【问题标题】:how to create table view who's 1st cell look like as selected?如何创建第一个单元格看起来像被选中的表格视图?
【发布时间】:2010-06-15 14:59:59
【问题描述】:

我创建了一个 ipad 应用程序,其中第一个屏幕是拆分视图。在该主视图中是表视图,详细视图包含图像视图控制器。我的问题是,当最初加载应用程序时,表格视图的第一个单元格应该被视为已选中,并且相应的图像视图应该出现在详细视图中。

【问题讨论】:

    标签: iphone objective-c ipad


    【解决方案1】:

    似乎您不仅需要将单元格视为已选中,还需要选中该单元格(以显示相应的图像)

    你应该看到这个帖子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];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-19
      • 2015-08-07
      • 1970-01-01
      • 1970-01-01
      • 2014-08-22
      • 1970-01-01
      • 2020-09-11
      • 1970-01-01
      相关资源
      最近更新 更多