Created
June 9, 2011 20:54
-
-
Save ahmetardal/1017722 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 *cellId = @"CopyableCell"; | |
CopyableCell *cell = (CopyableCell *) [tableView dequeueReusableCellWithIdentifier:cellId]; | |
if (cell == nil) { | |
cell = [[[CopyableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId] autorelease]; | |
} | |
[cell setIndexPath:indexPath]; | |
[cell setDelegate:self]; | |
cell.selectionStyle = UITableViewCellSelectionStyleNone; | |
cell.accessoryType = UITableViewCellAccessoryNone; | |
cell.textLabel.text = [self.tableData objectAtIndex:indexPath.row]; | |
return cell; | |
} |
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
#pragma mark - | |
#pragma mark CopyableCellDelegate Methods | |
- (void) copyableCell:(CopyableCell *)cell selectCellAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
[self.demoTableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; | |
} | |
- (void) copyableCell:(CopyableCell *)cell deselectCellAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
[self.demoTableView deselectRowAtIndexPath:indexPath animated:NO]; | |
} | |
- (NSString *) copyableCell:(CopyableCell *)cell dataForCellAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (indexPath.row < self.tableData.count) { | |
return [self.tableData objectAtIndex:indexPath.row]; | |
} | |
return @""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment