Created
July 18, 2012 02:05
-
-
Save richy486/3133622 to your computer and use it in GitHub Desktop.
cellForRowAtIndexPath
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 *cellIdentifier = @"cellIdentifier"; | |
// Normal cell | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
if (cell == nil) | |
{ | |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease]; | |
} | |
// Custom Cell | |
MagicCell *cell = (MagicCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
if (cell == nil) | |
{ | |
NSArray *outlets = [[NSBundle mainBundle] loadNibNamed:@"MagicCell" owner:self options:nil]; | |
for (id currentObject in outlets) | |
{ | |
if ([currentObject isKindOfClass:[MagicCell class]]) | |
{ | |
cell = (MagicCell*) currentObject; | |
[cell.accessoryView setHidden:YES]; | |
break; | |
} | |
} | |
if (cell == nil) | |
{ | |
return nil; | |
} | |
} | |
// Do something for each cell | |
// ... | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment