I am setting a rightbarbuttonitem in from a viewController using the following code:
UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(saveDetails)];
self.navigationItem.rightBarButtonItem = item;
It is appearing as shown in the image:
As you can see, the button which appears is not vertically aligned with either th leftbuttonitem or the title.
I also tried adjusting the alignment using the code mentioned here:
[self.navigationItem.rightBarButtonItem setTitlePositionAdjustment:UIOffsetMake(0, -10) forBarMetrics:UIBarMetricsDefault];
But this removes the custom font and moves the button even higher.
How can I set a rightbarbuttonitem which is aligned AND maintains the custom font set using the UIAppearance proxy?
EDIT:
I even tried using
[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveDetails)];
but the result is exactly as shown in the first image.
UPDATE (Sep 20):
It seems that I will have to go with Alexander's answer, anybody with a cleaner solution?