ios - why setting "translatesAutoresizingMaskIntoConstraints" to false before setting imageView, will show no images? -
i new ios, learning constraints in scroll view.
i have following code (type1):
wallpaper.view.translateautoresizingmaskintoconstraints = false wallpaper.wallpaperimage = uiimage(named: backgroundimagename)
if build app, screen shows white screen. have checked nil
possibility of image it's not.
then swapped code this(type2):
wallpaper.wallpaperimage = uiimage(named: backgroundimagename) wallpaper.view.translateautoresizingmaskintoconstraints = false
then, image show up. question why affect imageview? have seen several codes using type1 , work normally.
thank reading!
i think because intrinsic content size of imageview while image = nil
cgsize.zero
if define width
, height
constraint explicitly different result, when set image before intrinsic content size of uiimageview
have value defined uiimage
contained in uiimageview
Comments
Post a Comment