Add uibutton to navigationController title bar iphone?

You can do that via the viewDidLoad method of the view controller: (void)viewDidLoad { super viewDidLoad; UIBarButtonItem* infoButton = UIBarButtonItem alloc initWithTitle:@"Info" style:UIBarButtonItemStylePlain target:self action:@selector(infoButtonSelected:); self.navigationItem. RightBarButtonItem = infoButton; infoButton release; } In the example about when the button is tapped, you should also have the method: (void)infoButtonSelected:(id)sender { NSLog(@"button tapped"); // whatever needs to happen when button is tapped }.

You can do that via the viewDidLoad method of the view controller: - (void)viewDidLoad { super viewDidLoad; UIBarButtonItem* infoButton = UIBarButtonItem alloc initWithTitle:@"Info" style:UIBarButtonItemStylePlain target:self action:@selector(infoButtonSelected:); self.navigationItem. RightBarButtonItem = infoButton; infoButton release; } In the example about when the button is tapped, you should also have the method: - (void)infoButtonSelected:(id)sender { NSLog(@"button tapped"); // whatever needs to happen when button is tapped }.

The example you gave is perfect. Thanks a lot! – dubbeat May 17 '10 at 12:11.

You add it to the current controllers navigationItem. It's got the leftBarButtonItem and rightBarButtonItem properties.

UISegmentedControl *segmentedControl = UISegmentedControl alloc initWithItems: NSArray arrayWithObjects: UIImage imageNamed:@"change frame btn. Png", UIImage imageNamed:@"im. Jpeg", //UIImage imageNamed:@"im.

Jpeg", nil; segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged; segmentedControl. Frame = CGRectMake( 0, 0, 150, 30); segmentedControl. SegmentedControlStyle = UISegmentedControlStyleBar; segmentedControl.

Momentary = YES; UIBarButtonItem *segmentBarItem = UIBarButtonItem alloc initWithCustomView:segmentedControl; segmentedControl release; self.navigationItem. RightBarButtonItem = segmentBarItem; segmentBarItem release; } - (void)segmentAction:(id)sender{ if(sender selectedSegmentIndex == 0) { } if(sender selectedSegmentIndex == 1) { }.

I'm asking because I'm seeking a consistent position to display an "about" button.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions