Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3. static NSString *cellIdentifier = @"Cell";
  4.  
  5. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  6. if (cell == nil)
  7. {
  8. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell1"];
  9.  
  10. [cell clearsContextBeforeDrawing];
  11.  
  12. UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  13. btn.frame = CGRectMake(5,220,70, 30);
  14. [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal ];
  15. [btn setTitle:[NSString stringWithFormat:@"button == %ld",(long)indexPath.row] forState:UIControlStateNormal];
  16. btn.tag = indexPath.row;
  17. [btn addTarget:self action:@selector(methodOfButton:) forControlEvents:UIControlEventTouchUpInside];
  18. [cell.contentView addSubview:btn];
  19. }
  20.  
  21. return cell;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement