2016-06-02 1 views
-1

텍스트보기를 액세서리보기로 추가하고 있지만 textlabel과 액세서리보기의 텍스트 필드가 서로 겹치고 있습니다. 가장 이상한 점은 셀의 배경색을 설정하면 전체 셀에 걸쳐 표시된다는 것입니다. 그러나 프레임을 확인할 때 너비는 240.0입니다. 내가 여기서 무엇을 놓치고 있니? 당신은 제약 누락 Cell SnapshotTextLabel 및 액세서리보기와 같은 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; 
} 
+0

나는 downvote가 무엇인지 물어볼 수 있습니까? –

답변

0

, 어떻게 제약와 함께 작동하는 방법을 살펴 보시기 바랍니다.

+0

textLabel에 대한 제약 조건을 설정하고 잘 작동하지만 accessoryView에 대한 속성을 설정할 때마다 앱이 다운됩니다. –

+0

@ZeeshanAnjum 제약 코드로 답을 편집 할 수 있다면 틀린 말을 할 수 있습니다. 지금 제약 조건을 포함하지 않는 코드로 제약 조건 문제를 설명합니다. 스토리 보드에서 제작 한 경우 스크린 샷을 추가하십시오. –

관련 문제