Apple SDK or IB doesn't allow to add banner images to the top of the view.
Similar to the MySpace iPhone app's banner on the top of the Navaigation Views, we wanted to add a Banner Logo image on the top the Nav Controller.
Here's the solution:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//create a view for the banner logo add the banner to this view
UIImageView *logoImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_banner.png"]];
// put this banner above the nav bar ---> -30 as Y point means put it in the -30 Y-axis of the parent view --> which will be the tabbarcontroller.view.
UIView *bannerLogoView = [[UIView alloc] initWithFrame:CGRectMake(0,-30, 320, 30)];
[bannerLogoView addSubview:logoImage];
[logoImage release];
//add the tabcotroller as a subview of the view
[tabBarController.view addSubview:bannerLogoView];
[bannerLogoView release];
//Move the root view to show status bar & banner
tabBarController.view.frame = CGRectMake(0,50, 320, 430);
//add the modified logo view to window
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
return YES;
}
I used this code to add a view as a banner above a navigation bar. I wanted to display information in this banner regarding the selections made in tables throughout the application. I added an outlet to the appdelegate and hooked up a label to the outlet. Now i expected to be able to set the text of the label. No errors are reported but the text does not change on the screen. Any ideas?
Adding a banner above the Navigation Controller.
Apple SDK or IB doesn't allow to add banner images to the top of the view.
Similar to the MySpace iPhone app's banner on the top of the Navaigation Views, we wanted to add a Banner Logo image on the top the Nav Controller.
Here's the solution:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//create a view for the banner logo add the banner to this view
UIImageView *logoImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo_banner.png"]];
// put this banner above the nav bar ---> -30 as Y point means put it in the -30 Y-axis of the parent view --> which will be the tabbarcontroller.view.
UIView *bannerLogoView = [[UIView alloc] initWithFrame:CGRectMake(0,-30, 320, 30)];
[bannerLogoView addSubview:logoImage];
[logoImage release];
//add the tabcotroller as a subview of the view
[tabBarController.view addSubview:bannerLogoView];
[bannerLogoView release];
//Move the root view to show status bar & banner
tabBarController.view.frame = CGRectMake(0,50, 320, 430);
//add the modified logo view to window
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
return YES;
}
Why can't I edit the banner
I used this code to add a view as a banner above a navigation bar. I wanted to display information in this banner regarding the selections made in tables throughout the application. I added an outlet to the appdelegate and hooked up a label to the outlet. Now i expected to be able to set the text of the label. No errors are reported but the text does not change on the screen. Any ideas?