How to change to a grouped table view in xcode without using Interface Builder

北城以北 提交于 2019-12-13 07:32:06

问题


I have a table that I created within xcode so there is no nib file in this case. I want to make my table into the 'Grouped' style but im not sure how.

I think it has somthing to do with the method below, the problem is Im not really sure how to call it, I do understand how methods work I'm just not too sure on where to start with this one:

- (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)UITableViewStyleGrouped

So could someone tell me how to call it? The problem is that its not a method I wrote its a built in one so I could put that line into my header file but how would I use it in my implementation file?

Thanks guys,


回答1:


It sounds like you need to get a better understanding of how objective-c works. What you have given us is not a method, but a method declaration. In your controllers viewDidLoad:, you would do something like:

table = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];


来源:https://stackoverflow.com/questions/2512417/how-to-change-to-a-grouped-table-view-in-xcode-without-using-interface-builder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!