문제

내가 행을 삭제하려고 할 때 나타나는 기본 삭제 버튼의 제목을 변경해야합니다. UITableView 편집을 설정 한 후 YES.

도움이 되었습니까?

해결책

UitableView Delegate 메소드에서 변경할 수 있습니다

- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath

다른 팁

빠른

이 메소드를 귀하에게 추가하십시오 UITableView 위임 (아마도 뷰 컨트롤러).

func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAtIndexPath indexPath: NSIndexPath) -> String? {
    return "Erase"
}

이렇게하면 버튼이 "지우기"라고 말하지만 원하는 문자열을 사용할 수 있습니다.

enter image description here

내 완전한 대답입니다 여기.

스위프트 3

작은 차이로 _

func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {
    return "Erase"
}

사람들을 위해 이미 'TitlefordeleteConfirmationButtonforyatindexPath'를 구현했습니다 여전히 동일한 '삭제'텍스트가 표시됩니다.

하려고 노력하다 입력하십시오 방법 기스로부터 Autocompletion을 사용하면 누군가의 복사를했고 약간 다른 오래된 표기법이 있고 호출되지 않았기 때문에!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top