I\'m presenting a UINavigationController
modally, from within an iOS app extension:
UINavigationController *nav = [[UINavigationController alloc] in
I'm hoping someone else finds a better way to do this, but my current solution is to create stand alone buttons and then use [[UIBarButtonItem alloc] initWithCustomView:]
with the button. Not ideal, and the indention is still there, but the weird jump doesn't happen anymore.
If the indention bothers you, you could also set negative fixed spaces on the outsides of the buttons to shift them closer to the edges.
Here's an example including the spacer:
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
[button sizeToFit];
UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc] initWithCustomView:button];
UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
[fixedSpace setWidth:-8.0f];
self.navigationItem.leftBarButtonItems = @[fixedSpace, leftBarButton];
This only happens to me on my share extension, and I don't have any problems related to presenting from a detached controller or anything like that.