How to give A button with image or title in Navigation bar...
This is an example for Right bar button...
UIImage* image3 = [UIImage imageNamed:@"ShareBtn"];
CGRect frameimg = CGRectMake(0,0, 35,35);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
[someButton setBackgroundImage:image3 forState:UIControlStateNormal];
[someButton addTarget:self action:@selector(shareButtonClicked) forControlEvents:UIControlEventTouchUpInside];
// [someButton setShowsTouchWhenHighlighted:YES];
UIBarButtonItem *shareButton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.rightBarButtonItem=shareButton;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@" outdoor" style:UIBarButtonItemStylePlain target:self action:@selector(backButtonClicked:)];
No comments:
Post a Comment