대체 색상을 tableviewcell으로 설정하는 방법을 알고 있지만 표시되는 모든 행을 번갈아 사용하도록 설정하려면 어떻게해야합니까? 예를 들어, 데이터가있는 셀이 2 개인 경우 2 셀만 배경색을 갖게됩니다. 빈 셀의 배경을 어떻게 채울 수 있습니까?uitableviewcell 데이터가없는 셀에 대해서도 배경 셀 색상이 번갈아 바뀌는 경우
1
A
답변
0
목록 끝에 더미 셀을 추가하십시오. (가) 더미 행 의 필요한 수를 추가 - (NSInteger)있는 tableView :
2
다음과 같은 몇 가지 일을하려고 (jQuery과 *)있는 tableView numberOfRowsInSection : (NSInteger) 섹션 {
if ([UIAppDelegate.getwaitlistArray count]>=numberOfVisibleRowsOnYourScreen) {
return [UIAppDelegate.getwaitlistArray count];
}
else{
return ([UIAppDelegate.getwaitlistArray count] + numberOfVisibleRowsOnYourScreen - [UIAppDelegate.getwaitlistArray count]);
}
}
(b)는 휴대 Alternare :
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
//alternating cell back ground color
if (indexPath.row%2 == 0) {
[cell setBackgroundColor:[UIColor colorWithRed:237.0/255.0f green:237.0/255.0f blue:237.0/255.0f alpha:1.0f]];
}else
{
[cell setBackgroundColor:[UIColor colorWithRed:247.0/255.0f green:247.0/255.0f blue:247.0/255.0f alpha:1.0f]];
}
}
(C) cellF에서 orRowAtIndexPath :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MyIdentifier"] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
//Create your lables/buttons/text/image
nameLabel.test=@"Whatever"; ..... ......
......
if (indexPath.row < [YourArray count]) { Populate your data here in the cells } else { cell.userInteractionEnabled=FALSE; [email protected]""; } return cell; }
+0
이 있다면 궁금 해서요? – callisto
관련 문제
- 1. UITableView 셀 색상이 사라지지 않습니다
- 2. UITableViewCell 배경 이미지 경로
- 3. 비활성화 된 버튼의 색상이 바뀌는 이유는 무엇입니까?
- 4. 회 전자 항목의 색상이 번갈아 표시됩니다.
- 5. UITableViewCell 배경 (패턴)
- 6. 힘있는 ListViewItem 배경 색상이
- 7. MYSQL : 데이터가없는 경우
- 8. UITableViewCell 선택이 모든 셀에 유지됩니다!
- 9. UITableViewCell (이미지 배경 포함)?
- 10. UITableViewCell iPhone의 배경 문제
- 11. bin 코드가 조금 바뀌는 경우
- 12. Ehcache - 데이터가없는 경우 SelfPopulatingCache 사용
- 13. 초점 셀에 셀을 연결하는 경우
- 14. 맞춤 셀 및 UITableViewCell 문제
- 15. 해당 셀에 주어진 값이있는 경우 고정되지 않은 셀 수의 합
- 16. UITableViewCell subclassed - 특정 위치의 배경
- 17. 자바 스크립트 데이터가 바뀔 때 행 색상이 번갈아 바뀝니다
- 18. 이 HTML 표에서 행 색상이 번갈아 나타나지 않도록하려면 어떻게해야합니까?
- 19. UITableViewCell 사용자 정의 - 배경 변경
- 20. 셀 배경 및 액세서리
- 21. 데이터가없는 빈 테이블
- 22. 아이폰의 UITableView에서 특정 셀/행을 선택하면 텍스트 색상이 바뀝니 까?
- 23. Android ListView 배경 색상이 항상 회색으로 표시됩니다.
- 24. 반 투명 배경 색상이 아닌 텍스트
- 25. 삽입 트리거 대신 Sql - 데이터가없는 경우
- 26. 삭제 프로그래밍 방식으로 UITableViewCell
- 27. 위치 UITableViewCell
- 28. UITableViewCell 하위 클래스의 셀 높이 가져 오기
- 29. UITableView 그룹 스타일 셀 배경
- 30. HTML 표 셀 수를 번갈아 변경하는 데 도움이됩니다.
내가 그렇게 할 수 있지만 Monotouch에 대한 코드이 번역 할 수있는 더 적절한 방법 – spentak