Is there any way to change the background color/image of the details UITableView in the EKEventViewController? I'm able to change the main UITableView but not the detail UITableView due to have no outlet for the table. For example, here is Apple's example source code for a Event App
You shouldn't just grab the subview at index:0. This may work in your current code, but it may break in future IOS releases, if Apple makes changes to the View.
This is more "future proof"
for (UIView *searchTableView in [yourEventController.view subviews]) {
if ([eventTableView isKindOfClass:[UITableView class]]) {
@try {
// change stuff to eventTableView
for (UIView *eventTableViewCell in [eventTableView subviews]) {
if ([eventTableViewCell isKindOfClass:[UITableViewCell class]]) {
@try {
[(UITableViewCell *)eventTableViewCell setBackgroundColor:[UIColor clearColor]];
}
@catch (NSException * e) {
}
}
}
}
@catch (NSException * e) {
}
}
}
Remember all the try's and catches! If apple makes changes to EKEventViewController than the code will probably still work, and it also won't crash if the changes break backwards compatibility.
Here is what you can use,
UITableView *eventTableView = [[yourEventController.view subviews]objectAtIndex:0];
this eventTableView
is reference to your EKEventViewController
's tableView now you can customize it.
Thanks,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With