I have the following code in my application:DidFinishLaunchingWithOptions:
where I attempt to set tab bar tint colour:
UIColor *colour = [UAColors getSeasonalColour];
self.tabBarController.tabBar.tintColor = colour; // SIGABORT here
[colour release];
getSeasonalColours
is:
+(UIColor *)getSeasonalColour {
UIColor *seasonalColour = 0;
if ( [UADates isSpring:[NSDate date]] )
seasonalColour = [UIColor greenColor];
else if ( [UADates isSummer:[NSDate date]] )
seasonalColour = [UIColor blueColor];
else if ( [UADates isAutumn:[NSDate date]] )
seasonalColour = [UIColor orangeColor];
else if ( [UADates isWinter:[NSDate date]] )
seasonalColour = [UIColor redColor];
else
seasonalColour = [UIColor blackColor];
return seasonalColour;
}
Right now UADates
is only a stub that returns true for isWinter
.
Why would this cause a crash? Using the same getSeasonalColours
works perfectly fine when I set the tintColor
on a navigation bar.
Setting a tab bar's tint color is only available starting with iOS 5 (and thus will crash on iOS 4 and earlier), while navigation bar tint colors have been around since iPhone OS 2.0.