此代码是否可以用于自定义 EKEventViews 的颜色(附有代码)
此代码是否可以用于自定义 EKEventViews 的颜色(附有代码)? ie 应该可以作为苹果 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];
}
is this code future proof for customising color of EKEventViews (code attached)? i.e should it be ok as apple rev's versions of IOS.
if not, what code would you recommend?
- (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];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
现在完全有效,但 Apple 可以随时更改
UITableView
或EKEventViewController
的结构,从而破坏您的自定义设置。尝试查看新的tintColor
属性。另外,您在哪里与表视图交互?你不只是展示它然后离开它,对吗?因此,您还可以在哪里更改它。我需要更多代码来帮助。您也可以将[detailViewController.view.subviews objectAtIndex:0].backgroundColor' 设置为
[UIColor YellowColor]` 等等。It's perfectly valid now, but Apple at any time could change the structure of the
UITableView
orEKEventViewController
breaking your customizations. Try looking into the newtintColor
properties. Also, where do you interact with the table view otherwise? You're not just presenting it and leaving it, correct? Therefore, where else can you possibly change it. I need more code to help. You can also just set[detailViewController.view.subviews objectAtIndex:0].backgroundColor' to
[UIColor yellowColor]` and likewise.