Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change splitView master cell text to images
    primarykey
    data
    text
    <p>I am exploring several ios examples about splitView but all with text in the master menu to select. I like to replace the text for a image so I get a list of custom buttons... Can anyone help me?</p> <p>.h</p> <pre><code>@property (nonatomic, retain) NSArray *siteNames; @property (nonatomic, retain) NSArray *siteAddresses; </code></pre> <p>.m</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. siteNames = [[NSArray alloc] initWithObjects: @"Yahoo", @"Google", @"Apple", nil]; siteAddresses = [[NSArray alloc] initWithObjects: @"http://www.yahoo.com", @"http:/www.google.com", @"http://www.apple.com", nil]; [self.tableView selectRowAtIndexPath: [NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:UITableViewScrollPositionMiddle]; } </code></pre> <p>EDIT</p> <p>OK, I do know how to put a image in a cell. What I don't know is how to do this with from a array, see my adjusted code here below:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. siteNames = [[NSArray alloc] initWithObjects: //@"Yahoo", //@"Google", //@"Apple", @"Yahoo.png", @"Google.png", @"Apple.png", nil]; ... } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } //cell.textLabel.text = [siteNames objectAtIndex:indexPath.row]; cell.imageView.image = [UIImage imageNamed:@" *** the right image ***"]; return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload