开发者

UITableView and UITableCellView, how does this work with core plot?

开发者 https://www.devze.com 2023-01-03 17:20 出处:网络
I\'m开发者_Go百科 very new to iPhone programming, and I\'m currently following tutos to understand the whole thing. I\'ve been able to do what I needed (retrive data from a JSON http server, parse the

I'm开发者_Go百科 very new to iPhone programming, and I'm currently following tutos to understand the whole thing. I've been able to do what I needed (retrive data from a JSON http server, parse them with YAJL and plot the data in core plot). I have done this in a "simple" view where I have added a UILayerHostingView as requested by core-plot.

I am now trying to follow this tuto: http://blogs.remobjects.com/blogs/mh/2010/01/26/p973 but I am missing the first part regarding the views...

My understanding is that I need to create a view with a UITableView first. Then add a UITableCellView to make the first cell be able to contain the graph ? Is this right ? Where does the method "(id)initWithStyle:(UITableViewCellStyle)style" come from ? For my needs, only the first cell needs to contain a graph, I will put some other info in the other cells.

As for now, I have created a new GraphListViewController, in the corresponding view I have added a listview but I do not see any auto generated methods regading cell customisation ? Do I need to implements DataSource in this controller and manually add some customisation methods ? Do I need to add a UITagbleViewCell to this UITableViewTable within IB ?

Hope I am not getting to confusing...

Thanks a lot for your help, Best Regards, Luc


To start with, create a new file ...

Cocoa Touch Class -> UIViewController subclass

and click the UITableViewController subclass checkbox. This will do all the tableview work for you. You can now open the xib file and change all the properties that you want for this.

Once this is done you need to populate the cells within the table. The first thing you need to do is to tell the controller how many cells to display. For this update the numberOfRowsInSection: method to return how many you want.

The next part is where you want to create the cell and is done mainly in the cellForRowAtIndexPath and for this I'm gonna redirect you to the following good tutorial on adding custom cells.

http://iphonedevelopment.blogspot.com/2009/09/table-view-cells-in-interface-builder.html

This explains a bit of the 'magic' that happens

Hope this helps

Liam

0

精彩评论

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