Created
January 18, 2012 18:45
-
-
Save blork/1634862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *StoreCellIdentifier = @"StoreCellIdentifier"; | |
static BOOL nibsRegistered = NO; | |
if (!nibsRegistered) { | |
UINib *nib = [UINib nibWithNibName:@"StoreLocationCell" bundle:nil]; | |
[tableView registerNib:nib forCellReuseIdentifier:StoreCellIdentifier]; | |
nibsRegistered = YES; | |
} | |
StoreLocationCell *cell = [tableView dequeueReusableCellWithIdentifier: StoreCellIdentifier]; | |
// Configure the cell... | |
if (storeLocations != nil) { | |
Store_location *sl = [storeLocations objectAtIndex:[indexPath row]]; | |
cell.name = sl.address_city; | |
cell.address = sl.fullAddress; | |
cell.pinImage = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png", [indexPath row]]]; | |
} | |
return cell; | |
} | |
----------- | |
// | |
// StoreLocationCell.m | |
// Look Book | |
// | |
// Created by Sam Oakley on 18/01/2012. | |
// Copyright (c) 2012 Luke Stringer & Sam Oakley. All rights reserved. | |
// | |
#import "StoreLocationCell.h" | |
@implementation StoreLocationCell | |
@synthesize name, nameLabel; | |
@synthesize address, addressLabel; | |
@synthesize pinImage, pinImageView; | |
- (void)setSelected:(BOOL)selected animated:(BOOL)animated | |
{ | |
[super setSelected:selected animated:animated]; | |
// Configure the view for the selected state | |
} | |
- (void)setName:(NSString *)n { | |
if (![n isEqualToString:name]) { | |
name = [n copy]; | |
nameLabel.text = name; | |
} | |
} | |
- (void)setAddress:(NSString *)a { | |
if (![a isEqualToString:address]) { | |
address = [a copy]; | |
addressLabel.text = address; | |
} | |
} | |
- (void)setPinImage:(UIImage *)pi { | |
if (![pi isEqual:pinImage]) { | |
pinImage = [pi copy]; | |
pinImageView.image = pinImage; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment