Xcode 버전 8.0이 포함 된 iOS 10 용으로 개발 중입니다. 내 .H 파일에NSMutableArray Datasrouce TableView UI 스크롤 후 고정
, 나는 나의의 TableView에 대한 데이터 소스입니다
@property (nonatomic, strong) NSMutableArray *items;
있습니다.
in viewDidLoad, 나는 [self setupTableViewItems] 함수를 호출한다.
self.items = [[NSMutableArray alloc] initWithCapacity:4];
self.items = [CellModel rows];
이 배열의 내부의 모든 개체 내 세포를 나타내는, 예 : 여기
CellModel *screenshot = [[CellModel alloc]
initWithParams: @"Screenshot"
subTitle: @"Select a screenshot"
image: [UIImage imageNamed: @"screenshot"]
viewName: Pictures
section: 3];
는 메소드 서명,
+ (NSMutableArray *)rows;
과 중요한 구현 세부 사항 (모든 개체의입니다 타입 CellModel) :
NSMutableArray *screenshots = [[NSMutableArray alloc] initWithCapacity:3];
[screenshots addObject:quickScreenshot];
[screenshots addObject:selectScreenshot];
[screenshots addObject:selectedScreenshotsCollectionView];
.....있는 tableView 처음으로 정확하게 데이터를로드
NSMutableArray *dataSource = [[NSMutableArray alloc] initWithCapacity:4];
[dataSource addObject:interactions];
[dataSource addObject:screenshots];
[dataSource addObject:problem];
[dataSource addObject:details];
return [dataSource mutableCopy];
는보기 좋은 외모와 아무것도가 누락되지 않습니다.
스크롤을 시작하면 셀에 대한 악세사리보기가 겹쳐지기 시작합니다. 특히 3 단계에서 악보보기가 없도록 정의되었지만 여전히 겹쳐서 다른 셀의 액세서리보기가 나타나는 경우가 있습니다. .
그러나 방향이 바뀌거나 몇 번 위아래로 스크롤하기 시작하면 UI가 잠기고 크래시가 발생하지 않고 Xcode에서 메시지가 표시되지 않습니다. 기억력이 커지면서 이것은 분명히 누출이지만 몇 시간 동안 찾으려고 노력한 후에 필사적입니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
GenericTableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:REPORT_CELL
forIndexPath: indexPath];
CellModel *current = [[self.items objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
cell.titleLabel.text = current.title;
cell.subtitleLabel.text = current.subTitle;
cell.icon.image = current.image;
if(indexPath.section == 0 && indexPath.row == 0)
cell.accessoryView = self.lastInteractionSwitch;
else if(indexPath.section == 0 && indexPath.row == 1)
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
else if(indexPath.section == 1 && indexPath.row == 0)
cell.accessoryView = self.lastScreenshotSwitch;
else if(indexPath.section == 1 && indexPath.row == 1)
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
else if(indexPath.section == 2 && indexPath.row == 0)
cell.accessoryView = self.starRatingView;
else if(indexPath.section == 2 && indexPath.row == 1)
cell.accessoryView = self.speechToTextButton;
else cell.accessoryView = UITableViewCellAccessoryNone;
return cell;
내 맞춤 셀에는 설정되는 세 가지 속성이 있습니다. 사용자 정의 셀의 유형은 "자막"이며 속성은 IB로 연결됩니다.
우선 포인터 참조가 없기 때문에 생각하고, intiutive하고 명백한 것들 (strong || retain)을 시도하고, NSArray를 데이터 소스, 같은 문제로 갖는 것으로 옮겼습니다. 셀을 100 % 사과 (100 % 맞춤)로 변경했습니다. 동일한 문제입니다.
여기 무슨 일입니까?
당신은 액세서리보기가 엉망지고,하지만 난 당신이 당신의 대기열 세포에 cellForRowAtIndexPath''의 아무 곳이나 액세서리를 설정이 표시되지 않는 것입니다 언급. 셀을 표시하기 전에이 속성을 설정하고 있습니까? 또한 테이블 (및 해당 셀)이 화면의 유일한 UI 요소입니까? – Stonz2
예, 그렇습니다. 내 cellForRowAtIndexPath : 정의를 업데이트했습니다. 탐색 바의 barTintColor를 변경하고 반투명으로 설정 한 다음 텍스트를 흰색으로 설정하고 오른쪽 버튼 항목을 추가합니다. 그것 이외에, 나는 tableview만을 제공 할뿐입니다. –
UI 잠김 및 메모리 증가 = 주 스레드에서 무한 재귀/루프가 발생합니다 (가능성 있음).디버거를 사용하여 실행하십시오. 디버거에서 일시 중지를 누르면됩니다. 코드에서 멈추지 않는다면 몇 번 해보십시오. 행운? –