开发者

UITableView problems [closed]

开发者_JAVA技巧 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

I've added a UITableView component to a ViewController in Interface Builder to make it easier to customise as the UITableViewController won't let me set a background image.

I've then implemented some basic functions just to test if it works, but cannot get it to display any cells - does anyone have any suggestions on how to get it working?

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section     {
    if (section == 1) {
        return 2;
    }
    else {
        return 1;
    }
}

I've created a UITableView IBOutlet called tripSettings and have wired it up as a referencing outlet


Make sure that the tableView as your view controller as dataSource and delegate.


you have to make your class inherit from UIViewController , and then set the delegate and datasource to the file's owner using the interface builder


For tableView, several entities in an app must interact: the view controller, the table view itself, and the table view’s data source and delegate.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜