0

When putting a solid background color should you use an image for more accessibility or just change the color in the view settings?

NOTE: I need to change the background later on in the app.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
alvileg
  • 3
  • 1
  • 4
  • 1
    I don't understand the question. If you need to change the view's background color you just have to use its property. An image is heavier to load, to process and to display on the screen. – Yannick Loriot Nov 11 '18 at 15:38
  • @YannickLoriot I believe that the OP is talking about having multiple views in multiple screens with the same color, which can be quickly switched to another color (which would be a bit tedious if only the *Attributes inspector* is being used to set the background color). – D V Nov 11 '18 at 15:42
  • @DV you can always copy paste a view in storyboard (keeping the bg color) and set its constraints as needed in the current context. Using an image for that seems wasteful – giorashc Nov 11 '18 at 15:44
  • @giorashc Of course, and that is the same effort is the OP is talking about, if I'm right. To me, it looked like the OP wanted to identify the most effortless/best way to handle this case. Copy-pasting and settings the constraints again require you to do this for each of the items you need to change, which I would not personally suggest. – D V Nov 11 '18 at 15:46

1 Answers1

0

If you have to change the background image/color dynamically, it would mostly be lighter on the app size and view (though the adverse effect might be insignificant) to manage background color of a UIView, than have an additional UIImageView loading up your background image from the assets.

You might also have to keep multiple colored assets in the bundle to account for the dynamicity, if you are to use image assets for handling the same.

If you are targeting for iOS 11.0+, you should surely go with using colors, as you can use color asset to manage your colors at a centalized location, which can be used directly from both the Interface builder and code.

D V
  • 348
  • 2
  • 10