ios - Swift: My UINavigationBar's background image is spreading too far down -
here code navigation controller:
@iboutlet weak var navbar: uinavigationbar! override func viewdidload() { super.viewdidload() // additional setup after loading view. navbar.setbackgroundimage(uiimage(named: "top_splash")!.resizableimagewithcapinsets(uiedgeinsetsmake(0, 0, 0, 0), resizingmode: .stretch), forbarmetrics: .default) }
however, background image spreads on first view in storyboard, , cannot see anymore. here image of looks like:
as can see, nav bar doubles in size accomadate picture. how can fix this?
the problem top_splash
big start with. can stretch image resizableimage
can't compress it. start image smaller standard height of navigation bar (44 points) , well.
alternatively, set nav bar's clipstobounds
true
, other bad things happen — example, wouldn't stretch behind status bar correctly.
Comments
Post a Comment