0

此代码是否可用于自定义 EKEventViews 的颜色(附加代码)?即它应该可以作为苹果rev 的IOS 版本。

如果没有,你会推荐什么代码?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {   
    self.detailViewController = [[EKEventViewController alloc] initWithNibName:nil bundle:nil];         
    detailViewController.event = [self.eventsList objectAtIndex:indexPath.row];
    [self.navigationController pushViewController:detailViewController animated:YES];

    // CODE UNDER QUESTION HERE
    UITableView *tv = (UITableView*)[detailViewController.view.subviews objectAtIndex:0];
    [tv setBackgroundColor:[UIColor yellowColor]];
    UIView *v = (UIView*)[[tv visibleCells] objectAtIndex:0];
    v.backgroundColor = [UIColor greenColor];
}
4

1 回答 1

1

它现在完全有效,但 Apple 随时可能更改UITableViewEKEventViewController破坏您的自定义结构。尝试查看新tintColor属性。另外,您在哪里与表格视图交互?你不只是展示它然后离开它,对吗?因此,你还能在哪里改变它。我需要更多代码来提供帮助。你也可以只设置[detailViewController.view.subviews objectAtIndex:0].backgroundColor' to[UIColor yellowColor]` 等等。

于 2011-12-12T17:04:53.560 回答