5 개의 섹션이있는 응용 프로그램에서 TableView를 만들었습니다.iphone - UITableView 스크롤 문제
섹션 1 - 4는 분당 하나의 행만 포함하고 섹션 5는 5 개의 행을 포함합니다.
TableView를 화면에서 스크롤 할 때까지 모든 것이 제대로 작동합니다. 내 첫 번째 섹션 및 행 (셀)에서 그것에있는 텍스트가있는 UILabel에 accessoryView를 설정했습니다.
다른 모든 셀마다 accessoryType으로 공개 버튼이 있습니다.
내가 tableview를 스크롤하면 어떻게 든 첫 번째 셀에있는 텍스트가 마지막 셀에 나타납니다!
NSString을 배열에 추가 한 다음 사전으로 NSMutableArray에 추가하여 데이터를 설정했습니다. 여기
그리고
내 셀 설정 :- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// UISwitch *aUISwitch = [[[UISwitch alloc]initWithFrame:CGRectZero]autorelease];
// Configure the cell.
NSDictionary *dictionary = [listOfSettings objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"Settings"];
NSString *cellValue = [array objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
if([cellValue isEqualToString:@"Status"]){
UILabel *viewLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 20)];
[viewLabel setText:@"Connected"];
cell.accessoryView = viewLabel;
[viewLabel release];
}
else{
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
}
return cell;
}
나는이 함께 할 수있는 뭔가가 추정 그래서 그들은 화면을 갈 때 나는 세포가 삭제/제거 얻을 알아? 화면을 벗어나서 다시 나타나는 셀을 처리 할 때 권장되는 방법은 무엇입니까?
25 점을 받으세요! :) 매우 감사합니다! –