저는 iOS 7에 있고, UITableView (UITableView) (데이터 소스와 위임자를 연결 함)를 사용하고 편집을 사용하려고합니다. UIStoryboard에서 Dynamice Prototype으로 사용자 정의 UITableViewCell을 사용합니다. 편집 버튼 (self.editButtonItem)을 클릭하면 이름 변경이 완료된 것을 볼 수 있지만 들여 쓰기 아이콘은 없습니다 (- 아이콘). 셀에서 스 와이프하면 삭제 버튼이 생깁니다. 사용자 정의 버튼을 만들 필요가 내의 모든 콘텐츠는 작동하지 않습니다 UIViewController에 self.editButtonItem
에서있는 contentView사용자 정의 UITableViewCell이 들여 쓰기를 표시하지 않습니다.
0
A
답변
3
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[arr removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationBottom];
}
}
- (IBAction)editbtn:(id)sender {
if (self.tableView.editing) {
self.tableView.editing = NO;
[edit setTitle:@"Edit" forState:UIControlStateNormal];
}
else{
self.tableView.editing = YES;
[edit setTitle:@"Done" forState:UIControlStateNormal];
}
}
이 코드가 도움이된다고 생각합니다.
+0
이미 받으실 수 있습니다! 하지만이게 네가 사용할 수있는거야! –
-2
에
self.navigationItem.leftBarButtonItem = self.editButtonItem;
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
// Return NO if you do not want the specified item to be editable.
return YES;
}
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleDelete;
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
:
여기 내 코드입니다.
관련 문제
- 1. UIImageView가있는 사용자 지정 UITableViewCell이 이미지를 표시하지 않습니다.
- 2. 사용자 지정 UITableViewCell이 내용을 표시하지 않습니다.
- 3. UITableViewCell이 텍스트를 표시하지 않습니다.
- 4. 사용자 지정 UITableViewCell이 텍스트 필드를 표시하지 않습니다.
- 5. UITableViewCell이 전체 텍스트를 표시하지 않습니다.
- 6. UITableViewCell이 하위보기를 표시하지 않습니다. UITextView
- 7. innerHTML은 들여 쓰기를 고려하지 않습니다.
- 8. 사용자 정의 UITableViewCell이 뷰를 제대로 숨기지 않습니다.
- 9. 사용자 정의 UITableViewCell이 textLabel에서 응답하지 않습니다.
- 10. 사용자 정의 UITableViewCell이 중복되지 않게하기
- 11. C 매크로/# 들여 쓰기를 정의 하시겠습니까?
- 12. 사용자 지정 UITableViewCell이 텍스트를 강조 표시하지 않음
- 13. 들여 쓰기를 공백으로 변환합니다.
- 14. 들여 쓰기를 항상 최소화해야합니까?
- 15. Github가 들여 쓰기를 변경합니다.
- 16. For 루프가 들여 쓰기를 따르지 않습니다.
- 17. 들여 쓰기를 사용하는 동안 들여 쓰기가 일치하지 않습니다.
- 18. 사용자 정의 UITableViewCell에 들여 쓰기 UITextLabel
- 19. 스크롤하는 동안 사용자 정의 UITableViewCell이 indexPath를 변경합니까?
- 20. Xcode가 자동 들여 쓰기를 중지했습니다
- 21. 출력 들여 쓰기를 유지하려면 어떻게합니까?
- 22. 들여 쓰기를 처리하는 방법 들여 쓰기 : 들여 쓰기가 바깥 쪽 들여 쓰기 레벨과 일치하지 않습니다.
- 23. CSS로 ul 들여 쓰기를 제거합니다.
- 24. 스토리 보드에서 reuseIdentifier를 설정하면 사용자 정의 UITableViewCell이 표시되지 않습니다.
- 25. iphone : 사용자 정의 UITableViewCell이 기본 셀보기보다 높습니다.
- 26. 사용자 정의 삭제 버튼을 클릭하면 UITableViewCell이 삭제됩니다.
- 27. HEREDOC이 코드 들여 쓰기를 방해합니다.
- 28. 들여 쓰기를 기반으로하는 Ruby 해시
- 29. AptanaStudio3에서 들여 쓰기를 취소 하시겠습니까?
- 30. 모든 들여 쓰기를 제거하는 함수
셀의 맞춤 콘텐츠가 셀의 'contentView'에 추가되고 셀에 직접 추가되지 않았는지 확인하십시오. – rmaddy
제 질문을 추가했습니다. 그림을보십시오. –
수정 버튼에 어떤 코드가 있습니까? – rdelmar