开发者

adding UITableView with code

开发者 https://www.devze.com 2023-01-08 23:01 出处:网络
I am very very new to the iPhone programming. I am kind of playing with the sample code. My first question is if it is possible to add the UITableView with the code only.

I am very very new to the iPhone programming. I am kind of playing with the sample code. My first question is if it is possible to add the UITableView with the code only. If it is then here is my code that i am trying to add UITableView to the navigation controller.

analyticsTable = [[UITableView alloc] init];    
[self.view.window add开发者_开发问答Subview:analyticsTable];
[self.view removeFromSuperview];

I dont know how to go about it

Thanks Varun


Take a look at the docs provided by Apple at http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/TableView_iPhone/CreateConfigureTableView/CreateConfigureTableView.html

Check about halfway down the bottom in the section "Creating a Table View Programmatically". I think that's exactly what you want.

These taught me how to programmatically do tables. I've never needed to use IB.


You need to set a frame, delegate and datasource. See this for more info

http://www.iphonedevsdk.com/forum/iphone-sdk-development/52938-uitableview-programmatically-creating-adding-datasource-delegate.html

Read to the bottom.

0

精彩评论

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

关注公众号