iOS导航条外观问题,背景图片不能铺满

//swift
var backGroundImage = UIImage(named: "顶部Bar")
        backGroundImage = backGroundImage?.resizableImage(withCapInsets: UIEdgeInsets.zero, resizingMode: UIImageResizingMode.stretch)
        
        nav.navigationBar.setBackgroundImage(backGroundImage, for: .default)
     nav.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.white]
//OC
UIImage *backGroundImage = [UIImage imageNamed:@"顶部Bar"]; backGroundImage = [backGroundImage resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch]; [self.navigationBar setBackgroundImage:backGroundImage forBarMetrics:UIBarMetricsDefault];

 

posted @ 2019-09-18 16:50  预估计  阅读(1005)  评论(0编辑  收藏  举报