开发者

iOS UITableViewController cells data filling

开发者 https://www.devze.com 2023-04-01 08:43 出处:网络
Two questions: 开发者_高级运维 I am trying to build a app that has a table view. I would like the user to click on a topic and then the next table view has a image on the left and text on the right.

Two questions:

开发者_高级运维
  1. I am trying to build a app that has a table view. I would like the user to click on a topic and then the next table view has a image on the left and text on the right. Does anyone know any sample code that would help me accomplish this?

    Example:

    iPad --> WiFi, and WiFi + 3G

    iPhone --> AT&T, Verizon

  2. Also is their a way to tag images in xCode? So in my table view I can only pull images with tag "x"?


Check out http://developer.apple.com/library/ios/#samplecode/TableViewSuite/Introduction/Intro.html for sample code on how to implement table views.

I don't understand your question about tagging. You can use [UIImage imageNamed:] to pull in images that are bundled in your app. Name them as you will.

See Dispelling the UIImage imageNamed: FUD for a discussion of this method.


First of all make a navigation based app. This gives you an app with a view controller in place with a table view on the screen.

Take a look at these for more info:

UITableViewController Class Reference

UITableViewCell Class Reference

In this last one take a look at initWithStyle:reuseIdentifier:, this will allow you to use the style you need, if you have default and add a picture to this cell it will show in the left side, pushing the text a little to the right.


For tagging an image you can simply do
image.tag = tagNumber;
For the cell image you can have like this:
image.tag = tagNumber;
cell.imageView.image = image;

0

精彩评论

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