Inferis/ViewDeck — Issue #29: setTitle: causes EXC_BAD_ACCESS on iPhone
Author: alexbell
Created: 2012-02-03 20:07:35+00:00
State: open

I am using ViewDeck with a UINavigationController (i am doing custom stuff with the backgroundView and using the titleView to display a UIImageView, perhaps this has something to do with it?). The setTitle: method fires due to the KVO telling it to (haven't dug in to why), setTitle: tries to set the title of center controller to nil (which already has a title of nil) and EXC_BAD_ACCESS occurs.

This does not occur on iPad with the same code, on iPad I am not setting a left bar button item, whereas I am in the iPhone. I am also using a MGSplitViewController as the root view controller for iPad, on iPhone the viewDeck controller is the root view controller.

I have locally changed my setTitle: method to this and it resolves it:
- (void)setTitle:(NSString *)title {
if ([self.centerController isKindOfClass:[UINavigationController class]]) {
UINavigationController *centerController = (UINavigationController *)self.centerController;
if (!centerController.title && !title) return;
}
[super setTitle:title];
self.centerController.title = title;
}