Reputation: 1159
If count of the Array that tableview is using is 1 then how to select the first row in the table i used the following code it is selecting but not navigating to next screen
NSIndexPath * ip =[NSIndexPath indexPathForRow:0 inSection:0];
[npTable selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionNone];
Upvotes: 0
Views: 132
Reputation: 61
you have to use some delegate methods for uitabelview
Add delegate method as below.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//here you have to write the code for to navigate next screen.
sample *sampleobject=[[sample alloc]init];
[self.navigationController pushViewController:sampleobject animated:YES];
}
that's it enjoy now u can naviagte to another page..
Upvotes: 2
Reputation: 2429
This only highlights the table cell. You would need to call the code which would appear in your tableView:didSelectRowAtIndexPath method or alternatively you could call it yourself like:
NSIndexPath * ip =[NSIndexPath indexPathForRow:0 inSection:0];
[self tableView: npTable didSelectRowAtIndexPath: ip];
Upvotes: 0