Reputation: 1096
I'm working on a project in swift for iPad
.
Have placed an image view in Navigation bar title view from story board.
The title view is displaying as expected in iOS 10
and below.
The same project when i run in iOS 11 simulators and the physical devices Navigation bar is not showing the title view, any leads would be appreciated.
Upvotes: 0
Views: 2213
Reputation: 91
Create a custom view and override below method in the custom title view class to update view frame size at runtime.
Obj-C
-(CGSize)intrinsicContentSize
{
[super intrinsicContentSize];
return UILayoutFittingExpandedSize;
}
Swift
override var intrinsicContentSize: CGSize {
return UILayoutFittingExpandedSize
}
Check and let me know is it working for you or not ?
Upvotes: 4
Reputation: 309
Maybe this can help you
let widthConstraint = view.widthAnchor.constraint(equalToConstant: width)
let heightConstraint = view.heightAnchor.constraint(equalToConstant:height)
widthConstraint.isActive = true
heightConstraint.isActive = true
view
is the view that you use as a custom title view. And width
and height
is the size that you want to use. You can use:
let width = view.frame.width
let height = view.frame.height
Upvotes: 0