0
我正在使用带有文本字段的自定义UITableViewCell
。我想在按下右侧导航栏按钮时访问每个文本框的数据(例如:完成等)。我使用下面的代码:自定义UITableViewCell与UITextfield使用Xcode 7
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 2;
}
#pragma mark - UITableViewDelegate
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
CustomCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] objectAtIndex:0];
if (cell == nil) {
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.valueTextField.delegate = self;
switch (indexPath.row) {
case 0:
cell.itemImageView.image = [UIImage imageNamed:@"user.png"];
cell.valueTextField.placeholder = @"UserName";
break;
case 1:
cell.itemImageView.image = [UIImage imageNamed:@"mail.png"];
cell.valueTextField.placeholder = @"Email";
default:
break;
}
其不工作iOS9 – IKKA
是Xcode中抛出的任何错误? –