开发者

How do I populate a UITableView that is a subview of a subview?

My app features a UIWindow (inside of the AppDelegate?). Amazingly, (by mostly good luck), I've managed to get a NIB file to display inside of my AppDelegate's UIWindow. The resulting user interface which is displayed from my NIB file is comprised of three controls:

  • a UIView which serves as a sort of "background" (called "MainView")
  • a UITextView on top of MainView
  • a UITableView, also onto top of MainView, located geographically below the UITextView

I've spent the last month trying to populate that Table. Now 开发者_StackOverflowI'm asking here.

Please help.


I recommend you take a look at Apple's View Controller Programming Guide.

Specifically, take a look at the prerequisites section (delegate objects, and Model-View-Controller).

Once you have a basic understanding of how view controllers and delegation work, look at (and implement) the UITableViewDelegate and UITableViewDataSource protocols. The basic way to do this is to create a UITableViewController class - XCode has a template for this class with stubbed methods.


create a UITableViewController subclass, then you need to set it as the datasource and delegate of the tableView, once there you just need to fill out the appropriate methods.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;   
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜