我正在初始化 aEventEditViewController
以使用以下代码添加新事件:
- (void)presentEventEditViewControllerWithEventStore:(EKEventStore*)eventStore
{
EKEventEditViewController* vc = [[EKEventEditViewController alloc] init];
vc.eventStore = eventStore;
vc.delegate = self; // Probably self
EKEvent* event = [EKEvent eventWithEventStore:eventStore];
event.title = @"";
event.startDate = [NSDate date];
event.endDate = [NSDate date];
event.URL = [NSURL URLWithString:@""];
event.notes = @"";
event.allDay = NO;
vc.event = event;
vc.editViewDelegate = self;
[self presentViewController:vc animated:NO completion:nil];
}
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
UITableView *tableView = ((UITableViewController *)viewController).tableView;
if ([viewController isKindOfClass:[UITableViewController class]]) {
//((UITableViewController *)viewController).tableView.backgroundColor = [UIColor clearColor];
for (NSInteger j = 0; j < [tableView numberOfSections]; ++j)
{
for (NSInteger i = 0; i < [tableView numberOfRowsInSection:j]; ++i)
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Background-1.png"]];
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.backgroundColor = [UIColor clearColor];
}
}
}
}
UITableView 应该出现,但是当我开始滚动直到 aUITableViewCell
不再出现在 iPhone 的屏幕上然后向后滚动时,TableViewCell
它会忘记它的图像并变成标准UITableViewCell
(没有任何背景图像或自定义)。
滚动前的截图:http: //postimg.org/image/vzlj3t5o9/)
滚动后的截图:(http://postimg.org/image/c30836v2v/)
我该如何解决这个问题?
先感谢您!