Accessing cell attributes outside of cellForRowAtIndexPath

后端 未结 5 1269
既然无缘
既然无缘 2021-01-18 09:56

I have five fields setup on a Signup controller. Username, displayname, password, confirm password and email address.

They are setup with the following:



        
5条回答
  •  情话喂你
    2021-01-18 10:25

    Access Custom Label In UiTableView "didselectRow"

    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    UILabel *label = (UILabel*)[cell viewWithTag:101]; // you can get label like
    label.backgroundColor=[UIColor redColor];
    

    Get index path from button

    - (void) cellEditAction:(UIButton *)sender {
    
      CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:FriendsTable];
    NSIndexPath *indexPath = [FriendsTable indexPathForRowAtPoint:buttonPosition];
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    UILabel *label = (UILabel*)[cell viewWithTag:101]; // you can get label like
    label.backgroundColor=[UIColor redColor];
    
    }
    

提交回复
热议问题