简体   繁体   中英

iOS UITableViewController cells data filling

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM