This is an are to keep practical templates for ipad/iphone projects. I am often see myself googling to remember what to do in order to create a navcontrolller based app or how to customize the navbar etc. This is a place to keep all the answers for future reference.
Also this is a page to use the default patterns: UIColor
Making UIToolbar and UINavigationBar’s background totally transparent
reference: Iphone Tutorial This is the simple application of NavigationController. We will see how to build UINavigationController using Interface Builder. So let see how it will be worked.
Step 1: Crate a Window base application using template. Give the application name “NavigationController”.
So, add the navcontroller in the xib and then add the IBOutlet in the delegate file.
interface NavigationControllerAppDelegate : NSObject <UIApplicationDelegate> {
IBOutlet UIWindow *window;
IBOutlet UINavigationController *navigationController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
also
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
}
NavigationControllers need to load a default view in their structure. For that, create a new viewcontroller class along with nib file. Then make sure to connect the outlet to this in the IB. Voila!
Here’s the code:
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"NavigationBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end