Created
January 17, 2012 23:28
-
-
Save jakemoore/1629764 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 *)tblView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *Identifier = @"RentalCellView"; | |
UITableViewCell *cell = [tblView dequeueReusableCellWithIdentifier:Identifier]; | |
if (cell == nil) { | |
[[NSBundle mainBundle] loadNibNamed:@"RentalCellView" owner:self options:nil]; | |
UIButton *button; | |
button = (UIButton *)[self.tvCell viewWithTag:4]; | |
button.hidden = NO; | |
[button addTarget:self action:@selector(finishInspection:) forControlEvents:UIControlEventTouchUpInside]; | |
cell = tvCell; | |
self.tvCell = nil; | |
} | |
Rental *rental = (Rental *)[rentalsArray objectAtIndex:indexPath.row]; | |
UILabel *label; | |
label = (UILabel *)[cell viewWithTag:2]; | |
label.text = rental.title; | |
label = (UILabel *)[cell viewWithTag:3]; | |
if (rental.company != nil) { | |
label.text = [@"Rental: " stringByAppendingString:rental.company]; | |
} | |
UIButton *button; | |
button = (UIButton *)[cell viewWithTag:4]; | |
button.hidden = NO; | |
NSLog(@"setting tag to %d", indexPath.row); | |
button.tag = indexPath.row; | |
[button addTarget:self action:@selector(finishInspection:) forControlEvents:UIControlEventTouchUpInside]; | |
UIImage *backgroundImage = [[UIImage imageNamed:@"ButtonSmallOrange"] stretchableImageWithLeftCapWidth:5 topCapHeight:0]; | |
[button setBackgroundImage:backgroundImage forState:UIControlStateNormal]; | |
return cell; | |
} | |
- (IBAction)finishInspection:(id)sender { | |
NSLog(@"finishInspection:"); | |
int row = ((UIButton *)sender).tag; | |
NSLog(@"row: %d", row); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment