I want to adjust the size of the UINavigationController view to fill the entire screen when the category list is hidden, and shrink when the list is displayed.
I have it working, except at the start of the animation/submit When the frame is set in the block, the title of the navigation bar immediately jumps to its new offset.
Any ideas how to prevent the title from jumping?
< /p>
#import "UINavigationBar+My.h"
@implementation UINavigationBar (My)
- (void)layoutSubviews {
for (id obj in [self subviews]) {
if ([NSStringFromClass([obj class]) isEqualToString:@"UINavigationItemView"])
[(UIView *)obj setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin |UIViewAutoresizingFlexibleRightMargin];
else if ([NSStringFromClass([obj class]) isEqualToString:@"UIButton"]) {
if ([(UIButton *)obj center].x <([self center] .x / 2))
[(UIButton *)obj setAutoresizingMask:UIViewAutoresizingFlexibleRightMargin];
else
[(UIButton *)obj setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
}
}
@end
I hope it can help you;-)
I have an ipad application, I I want to hide and show a list of categories (a bit like a small view in a split view controller), and the main view that contains the UiNavigationController stack.
I want to resize the UINavigationController view to fill the entire screen when the category list is hidden, and shrink when the list is displayed.
I have it working, except at the beginning of the animation / When the frame is set in the submission block, the title of the navigation bar immediately jumps to its new offset.
Any ideas how to prevent the title from jumping?
I use it to fix the jump for title and right click in UINavigationBar.
#import "UINavigationBar+My.h"@implementation UINavigationBar (My)
- (void)layoutSubviews {
for (id obj in [self subviews ]) {
if ([NSStringFromClass([obj class]) isEqualToString:@"UINavigationItemView"])
[(UIView *)obj setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin];
else if ([ NSStringFromClass([obj class]) isEqualToString:@"UIButton"]) {
if ([(UIButton *)obj center].x <([self center].x / 2))
[( UIButton *)obj setAutoresizingMask:UIViewAutoresizingFlexibleRightMargin];
else
[(UIButton *)obj setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
}
}@end< /pre>
I hope it can help you ;-)