Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill iOS Stack View (UIStackView) with an image as a background?

I want to set stack view background to an image. For example, in Android, if I use 'Linear Layout' (equivalent to UIStackView), I can set a background image to the 'Linear Layout' irrespective of whatever the content (views) I add to it. How could I do this using XCode?

like image 967
kalan nawarathne Avatar asked Jan 27 '16 06:01

kalan nawarathne


1 Answers

You can't do this, UIStackView is a non-drawing view, meaning that drawRect() is never called. If you want a background image, consider placing the stack view inside a UIImageView.

like image 64
Roel Koops Avatar answered Sep 28 '22 02:09

Roel Koops