开发者

Simple ios app example (UITabbarController, UITableView)

I made app with three tab bars (thought IB) and it works. But, in one view I need table view and when I click on row, to get detailes about this row.

There is some project example how to do this programmatically without using Inte开发者_开发知识库rface builder?


To create an UITableView programmatically:

UITableView *myTable = [[UITableView alloc] initWithFrame:CGRectMake(0,0,320,420)];
myTable.dataSource = self;
myTable.delegate = self;

Then implement the UITableViewDelegate and UITableViewDataSource methods as you would have done when using InterfaceBuilder.

For selecting the row create the delegate function

– tableView:willSelectRowAtIndexPath:

and push a new UIView onto the nagivationController. Alternatively (if you don't use a navigationController), you can also present the new view as a modalViewController.


Check out the material for the Stanford iPhone programming classes. They have some great TableView sections that include samples for building these in code. See the course website.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜