该代码将来可用于自定义EKEventViews的颜色(附加代码) [英] is this code future proof for customising color of EKEventViews (code attached)

查看:109
本文介绍了该代码将来可用于自定义EKEventViews的颜色(附加代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码将来可用于自定义EKEventViews的颜色(附加代码)吗?即应该可以使用Apple rev的IOS版本.

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];
}

推荐答案

现在完全有效,但是Apple随时可能更改UITableViewEKEventViewController的结构,从而破坏您的自定义设置.尝试查看新的tintColor属性.另外,您在哪里与表格视图进行交互?您不只是展示并留下它,对不对?因此,您还可以在其他地方更改它.我需要更多代码来帮助.您也可以只设置[detailViewController.view.subviews objectAtIndex:0].backgroundColor' to [UIColor yellowColor]`,

It's perfectly valid now, but Apple at any time could change the structure of the UITableView or EKEventViewController breaking your customizations. Try looking into the new tintColor 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.

这篇关于该代码将来可用于自定义EKEventViews的颜色(附加代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆