iphone - 如何自定义EKEventView显示的EKEventEditView的颜色?

标签 iphone ios ekevent ekeventkit

背景:

问题:

  • 我的问题是如何自定义 EKEventEditView 的颜色,为此 View 不是由我的代码触发的,而是由 EKEventView 中的苹果代码触发的。

API 链接:

最佳答案

我不知道 Apple 将如何回应这段代码,但它确实有效:)

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(willShowController:) 
                                             name:@"UINavigationControllerWillShowViewControllerNotification" 
                                           object:nil];

和选择器方法:

-(void)willShowController:(NSNotification*)sender{
    NSLog(@"%@ ", [sender description]);

    UIViewController *controller = (UIViewController*)[sender object];

    if ([controller isKindOfClass:EKEventEditViewController.class]){
        UITableViewController *rootController = (UITableViewController*)[(UINavigationController*)controller visibleViewController];

        UITableView *tv = (UITableView*)[rootController view];
        [tv setBackgroundColor:[UIColor redColor]];
        UIView *v = (UIView*)[[tv visibleCells] objectAtIndex:0];
        v.backgroundColor = [UIColor blueColor];
    }
}

只有一个字符串 UINavigationControllerWillShowViewControllerNotification SDK 中找不到。但在这种情况下,它只是字符串.. 希望对您有所帮助。

关于iphone - 如何自定义EKEventView显示的EKEventEditView的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7883945/

相关文章:

ios - 无尽的 UICollectionView 幻灯片 + scrollToItemAtIndexPath

ios - 有没有办法在iOS应用程序中获取手机帐户?

ios - 如何在 UIScrollView 到达底部时停止滚动

ios - 如何将 "20110912T220000"(NSString) 给出的日期转换为 NSDate

iPhone : How to get the access to the default quicktime player that is launched?

iphone - cocos2dx中CCTexture2D的使用

iphone - iPhone 静态库中的核心数据

ios - 如何在幻灯片中显示pdf文件?(iphone应用开发)

ios - 如何在 iphone 日历中跟踪我的应用程序添加的事件

ios - 更改事件时区是否会影响共享事件中的其他人?