그룹의 첫 번째 행과 마지막 행의 색을 변경하는 방법 UITableView?그룹의 첫 번째 행과 마지막 행의 색을 변경하는 방법 UITableView?
내 솔루션을 나와 공유하고 싶지만 어떻게해야할지 모르겠다. 그래서 나는이 질문을 만든다. 그 죄송합니다. 휴대가 설정 한 후 UITableViewDataSource
방법에서
그룹의 첫 번째 행과 마지막 행의 색을 변경하는 방법 UITableView?그룹의 첫 번째 행과 마지막 행의 색을 변경하는 방법 UITableView?
내 솔루션을 나와 공유하고 싶지만 어떻게해야할지 모르겠다. 그래서 나는이 질문을 만든다. 그 죄송합니다. 휴대가 설정 한 후 UITableViewDataSource
방법에서
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
[self configureCell:cell atIndexPath:indexPath];
for (int x = 0; x < [[self.fetchedResultsController sections] count]; x++) {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:x];
int d = [sectionInfo numberOfObjects];
if(indexPath.section == x){
if (indexPath.row == 0 || indexPath.row == d-1) {
cell.backgroundColor = [UIColor blackColor];
}else{
cell.backgroundColor = [UIColor whiteColor];
}
}
}
return cell;
}
은 같은 것을 할 tableView:cellForRowAtIndexPath:
: 내 대답에
if (indexPath.row == 0 ||
indexPath.row == [tableView numberOfRowsInSection:indexPath.section] - 1) {
cell.backgroundColor = [UIColor redColor]; // or anything you want.
}
모습을. 첫 번째 또는 마지막 셀 또는 중간 셀의 색상을 각각 개별적으로 변경할 수 있습니다. – NamshanNet
Yaser, 질문을 게시하고 직접 답장을 원하면 ** 자신의 질문에 답하십시오 ** 옵션을 선택하십시오. 그러면 답을 게시 할 때까지 질문이 나타나지 않습니다. http://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/ – DrummerB