Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  2. NSString *cellIdentifier = kOddCellIdentifier;
  3.  
  4. CustomCell01 *oddCell = (CustomCell01 *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  5.  
  6. oddCell.myTextfield.delegate=self;
  7. oddCell.myTextfield.tag = indexPath.row;
  8. oddCell.myTextfield.text=[[self.Page01dataArray objectAtIndex:indexPath.row]objectForKey:@"value"];
  9. bool editable = [[[self.Page01dataArray objectAtIndex:indexPath.row] objectForKey:@"editable"] boolValue];
  10. if (editable==true) {
  11. oddCell.myTextfield.textColor=[UIColor redColor];
  12. } else {
  13. oddCell.myTextfield.textColor=[UIColor blackColor];
  14. [oddCell.myTextfield setBorderStyle:UITextBorderStyleNone];
  15. oddCell.myTextfield.enabled=NO;
  16. }
  17. [oddCell.myTextfield addTarget:self action:@selector(updateField:) forControlEvents:UIControlEventEditingDidEnd];
  18.  
  19. return oddCell;
  20. }
  21.  
  22. [nextTFarray addObject:oddCell.myTextfield];
  23.  
  24. - (BOOL)textFieldShouldReturn:(UITextField *)textField {
  25. int i=[nextTFarray count];
  26. int x=textField.tag+1;
  27. UITextField *nextTextField = (UITextField *)[nextTFarray objectAtIndex:x];
  28. if (x<i-1) {
  29. [nextTextField becomeFirstResponder];
  30. } else {
  31. [textField resignFirstResponder];
  32. }
  33. return YES;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement