navigation bar rightbaritem image-button bug iOS 11
Reason
The problem appears because from ios 11 UIBarButtonItem
uses autolayout instead of dealing with frames.
Solution
You should add width constraint for this image-button if you use Xcode 9.
button.widthAnchor.constraint(equalToConstant: 32.0).isActive = true
button.heightAnchor.constraint(equalToConstant: 32.0).isActive = true
PS
button
is not UIBarButtonItem
, it is UIButton
inside UIBarButtonItem
. You should set constraint not for UIBarButtonItem
, but for elements inside it.
iOS 11 navigation bar / uibarbutton items rendering issues
refer to UIBarButtonItem on iOS 11
UIBarButtonItem
uses autolayout instead of dealing with frames.
That's why the button is got stretched .
Modify:
widthConstraint = leftBackBtn.WidthAnchor.ConstraintEqualTo(27);
heightConstraint = leftBackBtn.HeightAnchor.ConstraintEqualTo(20);
widthConstraint.Active = true;
heightConstraint.Active = true;
Navigation bar custom image view issue in iOS 11
This types of issue faced by many developers because of in iOS 11 UIBarButtonItem
uses auto-layout instead of frames.
So you just want to set profile image on top right barButton items then please check my answer..
Other wise you can add constraints of imageView in you code like below
let widthConstraint = imageView.widthAnchor.constraint(equalToConstant: 34)
let heightConstraint = imageView.heightAnchor.constraint(equalToConstant: 34)
heightConstraint.isActive = true
widthConstraint.isActive = true
iOS 11 leftBarButtonItem/rightBarButtonItem location bug
It looks like your problem is caused by the search bar being bigger rather than something in the buttons.
You may want to try something like:
if #available(iOS 11.0, *) {
[[self.yourSearchBar.heightAnchor constraintEqualToConstant:44.0] setActive:YES]
}
Or investigate and implement the iOS 11 search bar changes.
Back button in navigation bar not getting tapped in ios 11
Overriding the following method in my custom UIView
class did the trick for me:
override var intrinsicContentSize: CGSize {
return UILayoutFittingExpandedSize
}
Related Topics
Finish All Asynchronous Requests Before Loading Data
How to Scroll to the Bottom of a Uitableview on the iPhone Before the View Appears
Drop-Down List in Uitableview in iOS
Alternative to Dtsendsignalflag to Identify Key Events in Instruments
What's Nslocalizedstring Equivalent in Swift
Logging Data on Device and Retrieving the Log
Xcode 6.1 Missing Required Architecture X86_64 in File
How to Make a Background Image Scale to Screen Size in Swift
Lldb (Swift): Casting Raw Address into Usable Type
Change Language in the App Programmatically in iOS
Wrong Color in Interface Builder
Iphone: Hide Uitableview Search Bar by Default
How to Reset the iOS Simulator from the Command Line
How to Route Audio to Speaker Without Using Audiosessionsetproperty
Ios9 Does Not Load Insecure Resources from a Secure Page (Ssl/Https)