adding UITableView with code
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.
精彩评论