M13ProgressViewBar doesn't reposition if navigation bar is resized.
markst opened this issue · 3 comments
markst commented
Perhaps I can update to use constraints?
markst commented
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot modify constraints for UINavigationBar managed by a controller'
markst commented
//Check if the progress view is in its superview and if we are showing the bar.
if (progressView.superview == nil && [self isShowingProgressBar]) {
[progressView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.navigationBar addSubview:progressView];
[self.navigationBar addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[progressView]-|"
options:0L
metrics:nil
views:NSDictionaryOfVariableBindings(progressView)]];
[self.navigationBar addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[progressView(2.5)]-|"
options:0L
metrics:nil
views:NSDictionaryOfVariableBindings(progressView)]];
}
markst commented
this can be resolved if the progress bar is part of the navigation controller view, rather than a subview of the navigation bar & will still produce the same desired effect.