텍스트보기를 액세서리보기로 추가하고 있지만 textlabel과 액세서리보기의 텍스트 필드가 서로 겹치고 있습니다. 가장 이상한 점은 셀의 배경색을 설정하면 전체 셀에 걸쳐 표시된다는 것입니다. 그러나 프레임을 확인할 때 너비는 240.0입니다. 내가 여기서 무엇을 놓치고 있니? 당신은 제약 누락 TextLabel 및 액세서리보기와 같은 UITextField는 서로 겹치고 있습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"Cell";
SettingCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell = [[SettingCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.accessoryView = nil;
cell.accessoryType = UITableViewCellAccessoryNone;
[cell.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
cell.textLabel.text = nil;
cell.detailTextLabel.text = nil;
cell.textLabel.text = @"Facebook default message with image";
UITextField* textField = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 500, 30)];
cell.accessoryView = textField;
textField.delegate = self;
textField.text = facebookDefaultMessageForImage;
textField.placeholder = @"Default message";
textField.tag = 1;
[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
return cell;
}
나는 downvote가 무엇인지 물어볼 수 있습니까? –