액세스 할 수없는 헤더 파일의 클래스에 범주를 추가 할 수 있습니까?"숨겨진"클래스에 범주를 추가하는 방법
테스트 목적으로 UITableViewCellDeleteConfirmationControl
에 카테고리를 추가하고 싶지만 클래스는 (내가 알 수있는 한) 개인 프레임 워크의 일부입니다.
어떻게하면됩니까?
정교화 (mihirios의 요청에 따라) : 당신은을 삭제하려고하면
나는 나타나는 확인 버튼 (큰 빨간 "삭제"버튼)을 눌러 시뮬레이션하기 위해 프랭크 테스트 프레임 워크를 확장하기 위해 노력하고 있어요 UITableViewCell
. 프랭크는 tap
방법을 UIControl
에 추가합니다. 어떤 이유로, 컨트롤을 두드리는 Frank의 일반적인 방법은 UITableViewCellDeleteConfirmationControl
클래스 (하위 클래스 UIControl
)에서는 작동하지 않습니다.
해결 방법을 만들었습니다. 다음 방법으로 UITableViewCell
에 카테고리를 추가했습니다.
- (BOOL)confirmDeletion {
if (![self showingDeleteConfirmation]) {
return NO;
}
UITableView *tableView = (UITableView *)[self superview];
id <UITableViewDataSource> dataSource = [tableView dataSource];
NSIndexPath *indexPath = [tableView indexPathForCell:self];
[dataSource tableView:tableView
commitEditingStyle:UITableViewCellEditingStyleDelete
forRowAtIndexPath:indexPath];
return YES;
}
이 테이블의 데이터 소스를 찾아 사용자가 확인 버튼을 탭하면 시스템이 무엇 인 (UITableView
에 대한 설명서에 따라) 그 tableView:commitEditingStyle:forRowAtIndexPath:
메소드를 호출합니다.
이 방법이 효과적이지만 tap
메서드를 추가하여 UITableViewCellDeleteConfirmationControl
을 탭 가능한 버튼으로 표시하고 Frank의 기본값을 재정의하는 것을 선호합니다. tap
메서드는 확인 버튼이 포함 된 셀을 찾은 다음 [cell confirmDeletion]
을 호출합니다.
UITableViewCellDeleteConfirmationControl
에 대한 카테고리를 선언하려고하면 컴파일러에서 " 'UITableViewCellDeleteConfirmationControl'인터페이스를 확인할 수 없습니다."라는 오류가 발생합니다.
누군가 클래스 덤프를 사용하여 생성 한 헤더 파일을 사용하려고하면 링커가 _OBJC_CLASS _ $ _ UITableViewCellDeleteConfirmationControl 기호를 찾을 수 없다는 불만을 표시합니다.
질문을 자세히 작성 하시겠습니까? – iMash