그룹화 된 스타일로 테이블 뷰를 만들었습니다. 이 테이블을 UIScrollView의 하위 뷰에 추가했습니다. 내가 가진 행의 수에 따라 테이블의 크기를 계산했습니다. 그래서 거기에 tableView에 대한 스크롤입니다. 나는 모든 세포를 볼 수있을 것이다.UITableView의 다시 사용한 셀이 그려지지 않습니다.
처음으로 표가 제대로 작동하고 모든 셀이 표시됩니다. 하지만 내 문제는 다음 페이지로 돌아와 다시 돌아와 테이블을 다시로드 할 때마다 할당 된 셀을 렌더링하고 다시 그려 보는 것입니다. 재사용되고있는 셀은 다시 그려지지 않습니다. tableView : cellForRowAtIndexPath :도 해당 셀에 대해 호출되지 않습니다.
나는 tableview의 스크롤이 비활성화되어 있기 때문에 재사용 된 셀의 cellForRowAtIndexPath 메소드가 호출되지 않아 렌더되지 않는다고 생각됩니다. 누군가 제발 도와주세요.
나는 다음과 같은 방법
m_TravellerDetailTable = [[UITableView alloc] initWithFrame: CGRectMake(2.0f, 0, 315.0f, 370) style: UITableViewStyleGrouped ];
float height = (tableViewCellHeight * [travellersArray count]);
m_TravellerDetailTable.frame = CGRectMake(2, 0, 315, height);
[m_TravellerDetailTable setBounces: NO];
[m_TravellerDetailTable setScrollEnabled: NO];
[m_BaseScrollView addSubview: m_TravellerDetailTable];
UITableViewDelegate 방법에있는 tableView를 만든
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [travellersArray count];
}
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return tableViewCellHeight;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[TravellerDetailCustomCellView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
TravellerDetailCustomCellView *customCell = (TravellerDetailCustomCellView *)cell;
[customCell.textLabel setText:[travellerInfoFromDetailForm objectForKey:@"DOB"]];
}
이 스냅 샷은 모든 셀
스냅 샷 쇼를 렌더링 jQuery과를 보여줍니다 uitableview 렌더 "성인 8"세포까지만. 그 후 테이블은 나머지 셀을 렌더링하지 않습니다.
단지 부수적이다. 모든 셀의 높이가 같으면 heightForRowAtIndexPath를 구현하는 대신 테이블 뷰의 rowHeight 속성을 설정하는 것이 더 좋습니다. –
'cellForRowAtIndexPath :'의 반환 값은 어디입니까? – Bryan
셀 재사용에 대해 이야기했지만 표시 한 코드에는 재사용되지 않습니다. 난 당신이 문제를 보여주는 방법 (아마도 실제 프로그램에서 단순화)에 대한 전체 코드를 게시하는 것이 좋습니다 것입니다. – Bryan