In my UINavigation bar added to a XIB with a number of UIViews the positioning of the left and right bar button item is way off:
Add button using the below code, it will definitely work.
CGRect frameimg = CGRectMake(0, 0, 60, 30);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
//[someButton setBackgroundImage:image3 forState:UIControlStateNormal];
[someButton setTitle:@"Update" forState:UIControlStateNormal];
[someButton addTarget:self action:@selector(updateProfile)
forControlEvents:UIControlEventTouchUpInside];
[someButton setShowsTouchWhenHighlighted:YES];
UIBarButtonItem *menuButton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.rightBarButtonItem = menuButton;