Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationBar loaded from Xcode8 xib issue #52

Open
wujianbotju opened this issue Oct 18, 2016 · 0 comments
Open

NavigationBar loaded from Xcode8 xib issue #52

wujianbotju opened this issue Oct 18, 2016 · 0 comments

Comments

@wujianbotju
Copy link

wujianbotju commented Oct 18, 2016

In Xcode8, size of any UIView loaded from xib has changed to be (1000, 1000). So if I load a single UINavigationBar(not from UINavigationController) from xib, its height will be 1020, the view of UIViewController will be covered by the overlay, which is added by LTNavigationBar.

Solution: Auto layout should be used, don't use "self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth;" Just like the following:

// self.overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth; // Comment out this line
self.overlay.translatesAutoresizingMaskIntoConstraints = NO;
[[self.subviews firstObject] insertSubview:self.overlay atIndex:0];
NSArray *hConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(0)-[overlay]-(0)-|" options:0 metrics:nil views:@{@"overlay":self.overlay}];
NSArray *vConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-(-20)-[overlay]-(0)-|" options:0 metrics:nil views:@{@"overlay":self.overlay}];
[self.overlay.superview addConstraints:hConstraints];
[self.overlay.superview addConstraints:vConstraints];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant