UIBarButtonItem position at the edge of the UINavigationBar

Can I place the UIBarButton of a custom image to the left or right of the edge of the UINavigationBar? The way I created my buttons looks best if the edge of the button touches the edge of the UINavigationBar.

+5
source share
1 answer

It is best here to subclass the UINavigation panel and override layout substructures.

In my example, I move my button to the far left if it has a 900 mark.

- (void) layoutSubviews {
    [super layoutSubviews];
    //override the navigation bar to move classes with 900 to the ledge
    for (UIView *view in self.subviews) {  
        if ([view isKindOfClass:[UIButton class]]) {  
            if (view.tag == 900)
                view.frame = CGRectMake(0,0, 88, 44);
        }

    }
}
+1
source

All Articles