开发者

Click on button to change to table view in Objective-c

I have two button in my program(figure A), I开发者_如何学编程 want to change to a table view(figure B) when I click on one button. Can someone please advise how to do that?

Thanks

Click on button to change to table view in Objective-c

Click on button to change to table view in Objective-c


Quite simple actually. In the button's handler method, create the table view controller and display it modally or push it on the navigation stack.

[myButton addTarget:self action:@selector(displayTableView:) forControlEvents:UIControlEventTouchUpInside];

-(void)displayTableView:(id)sender
{
      MyTableViewController* myTVC = [[MyTableViewController alloc] initWithNibName:@"myTVC" bundle:nil];
     [self.navigationController presentModalViewController:myTVC animated:YES];
     //[self.navigationController pushViewController:myTVC animated:YES]; //2nd option
    [myTVC release];
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜