Well I stumbled upon this work around. It isn't perfect but it has the desired effect. If someone has a more sound solution please volunteer your thoughts and I'll accept your answer over mine.
I got the idea from the accepted answer to this question: Placing a custom view based UIBarButtonItem in the navigation bar without default horizontal padding
I have simply added a new bar button item that acts as a spacer.
- (void) viewDidAppear:(BOOL)animated
{
// Create a spacer to go to the right of our custom button,
UIBarButtonItem *zeroSpacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil action:nil];
zeroSpacer.width = 0;
[upButton setTarget:self];
[downButton setTarget:self];
[downButton setAction:@selector(action1)];
[upButton setAction:@selector(action2)];
navItem.rightBarButtonItems = @[zeroSpacer, downButton, upButton];
}
I also did some work in the creation of the buttons to get them a little closer together for aesthetic reasons.
Here is how I am generating the buttons in viewDidLoad
of the DetailViewController
. The numbers in UIEdgeInsetsMake
really don't make that much sense to me but I just messed around until they looked right.
barButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
[barButton setImage:[UIImage imageNamed:@"arrow-up.png"]];
barButton.imageInsets = UIEdgeInsetsMake(0.0, -10, 0, -40);
barButton2 = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
[barButton2 setImage:[UIImage imageNamed:@"arrow-down.png"]];
barButton2.imageInsets = UIEdgeInsetsMake(0.0, -10, 0, 5);
Here is the result of before and after the partial scroll swipe.