Hello,
I just updated my iPhone 3GS to iOS 5 and my Xcode to Xcode 4.3 with SDK 5. I did this to test if my applications are all working properly on iOS 5 and it turns out that my custom navigation bar is not looking correct.
I have attached two images showing how it is supposed to be (the orange bar from iOS 4.3) and how it is in iOS 5 (the one with the blue navigation bar)
When running the application I get two errors in the console:
I am not sure what these errors means.
Here is my code for the custom navigation bar and how I am setting the title on top of it.
In CustomUINavigationBar.h:
In CustomUINavigationBar.m:
This is how I add the title in the ViewController.m:
I just updated my iPhone 3GS to iOS 5 and my Xcode to Xcode 4.3 with SDK 5. I did this to test if my applications are all working properly on iOS 5 and it turns out that my custom navigation bar is not looking correct.
I have attached two images showing how it is supposed to be (the orange bar from iOS 4.3) and how it is in iOS 5 (the one with the blue navigation bar)
When running the application I get two errors in the console:
Code:
*** ImageIO - could not find ColorSync function 'ColorSyncProfileCreateWithName'
*** ImageIO - could not find ColorSync function 'ColorSyncProfileCopyData'
Here is my code for the custom navigation bar and how I am setting the title on top of it.
In CustomUINavigationBar.h:
Code:
#import <Foundation/Foundation.h>
@interface CustomUINavigationBar : UINavigationBar {
}
@end
Code:
#import "CustomUINavigationBar.h"
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"UINavigationBar_Background.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
Code:
// Setting top title
[self setTitle:@"Program"];
UILabel *titleView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.navigationController.navigationBar.frame.size.width, self.navigationController.navigationBar.frame.size.height)];
[titleView setText:@"Festivalens Program"];
[titleView setBackgroundColor:[UIColor clearColor]];
[titleView setFont:[UIFont fontWithName:@"Arial-BoldMT" size:21.0]];
[titleView setShadowColor:[UIColor colorWithRed:1 green:0.854 blue:0.592 alpha:1]]; // Light orange
[titleView setShadowOffset:CGSizeMake(0, -1)];
[titleView setTextAlignment:UITextAlignmentCenter];
[titleView setTextColor:[UIColor blackColor]];
[[self navigationItem] setTitleView:titleView];
[titleView release];
Attachments
Last edited by a moderator: