사용자 지정 UITableViewCell이 매우 간단합니다. ios 6에서 새로운 기술을 사용하여 테이블보기를 초기화하고 싶습니다. 즉, 클래스 등록 및 식별자가있는 deque 셀 이후입니다. 그래서 UITableViewController 가지고, 하나의 프로토 타입 셀을 가지고 tableview 안에, 여기에 그것의 이미지입니다. 사용자 지정 UITableViewCell 초기화시 ios 6 이상한 동작
처음에는 테이블 뷰 컨트롤러 내부의 viewDidLoad 메서드에 클래스를 등록하는 것을 잊어 버렸고 정상적으로 작동했습니다. 여기 코드가 있습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"customCellIdentifier" forIndexPath:indexPath];
return cell;
}
하지만이 경우
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
에서
은 셀 초기화 과정에서 호출되지 않습니다.그리고 이후에 나는 viewdidload 안에 레지스터 클래스 기능을 넣었다. 여기 그것을 - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
시작이 호출하지만 난 모든 매장이 전무하다 initwithstyle 방법 내부 디버깅하려고 해요 때이 경우 세포가 절대적으로 비어 후 코드
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerClass:[CustomCell class] forCellReuseIdentifier:@"customCellIdentifier"];
}
입니다. 무슨 일이야? 내가 뭘 잘못하고있어?