Adding system bar button
UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
style:UIBarButtonItemStyleBordered
action:@selector(postNewCase:)];
self.navigationItem.rightBarButtonItem = saveButton;
[saveButton release];
-(IBAction)postNewCase:(id)sender {
}
Adding image bar button
UIImage *buttonImage = [UIImage
imageNamed:@"home_icon.png"];
UIButton *forwardButton = [UIButton buttonWithType:UIButtonTypeCustom];
[forwardButton
setBackgroundImage:buttonImage forState:UIControlStateNormal];
forwardButton.frame = CGRectMake(0, 0,
buttonImage.size.width, buttonImage.size.height);
[forwardButton addTarget:self
action:@selector(postNewCase:)
forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc]initWithCustomView:forwardButton];
Adding plain button
UIBarButtonItem *postButton = [[UIBarButtonItem alloc]
initWithTitle:@"Post"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(postNewCase:)];
self.navigationItem.rightBarButtonItem = postButton;
[postButton release];
Add background image to navigation bar
[self.navigationController.navigationBar
setBackgroundImage:[UIImage imageNamed: @"navigationBar.png"]
forBarMetrics:UIBarMetricsDefault];
Add logo to navigation bar
UIImage *image = [UIImage
imageNamed: @"new_kj_logo-150.png"];
UIImageView
*imageView = [[UIImageView alloc] initWithImage: image];
self.navigationItem.titleView
= imageView;
Hide Navigation default back button
self.navigationItem.hidesBackButton =
YES;
I really like and appreciate your post.Really thank you! Fantastic.
ReplyDeleteSap Sales And Distribution Tutoring Online From Canada