简体   繁体   中英

how to not select uitextfield that is in uitableviewcell

I am trying to load a new view from a tableview:didSelectRowAtIndexPath: method that happens when the uitableviewcell is selected, but because I have a custom uitextfield on that uitableviewcell it selects that text field instead of selecting the uitableviewcell.. how do I stop this from happening?

I do not know what your goal is... But you can solve your problem by using CGRectMake(110, 10, 185, 30)]

    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
    cell.selectionStyle= UITableViewCellSelectionStyleNone;
    UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(110, 10, 185, 30)];
    textField.clearsOnBeginEditing = NO;
    textField.textAlignment = UITextAlignmentRight;
    textField.returnKeyType = UIReturnKeyDone;
    textField.textColor = [UIColor blackColor];

    textField.font = [UIFont systemFontOfSize:15];
    textField.delegate = self;
    [cell.contentView addSubview:textField];

This way, the UItextField will be on the right half of the tableView and you can touch the left half of the tableView to select a row.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM