开发者

how to create table view who's 1st cell look like as selected?

开发者 https://www.devze.com 2023-01-03 08:03 出处:网络
I have created one ipad app where 1st screen is split view. In that master view is table view and detail view holds image view controller. My problem is that when initially application gets loaded the

I have created one ipad app where 1st screen is split view. In that master view is table view and detail view holds image view controller. My problem is that when initially application gets loaded the 1st cell of table 开发者_StackOverflowview should seen as selected and corresponding image view should appear at detail view.


It seems like you don't need only the cell to be seen as selected, but you need that cell to be selected (to make corresponding image appear)

You should see this post How do I select a UITableViewCell by default?

Here is sample code

-(void)viewDidLoad:(BOOL)animated {
    [uiTableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:0];
}

or if you actually want to make the cell look like selected, you can do something like

-(void)viewDidLoad:(BOOL)animated {
    UITableViewCell *cell= [uiTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
    [cell setHighlighted:TRUE animated:TRUE];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号