I am building a UI where the background color of the main view is black and the background color of some UIView elements within the View are white. The colors get displayed properly when there is not UI constraint for the UIView elements. However, when I add any constraint to the UIView elements, the white background seems to get transparent. I assume that it is still there, since UI constraints of other elements in relative to this UIView element are still on their correct place.
This is the structure of my UI (without UI constraints):
And this is how it looks like in simulator (iPhone XR 12.2):
Now I add the following UI constraints to the UIView element view_config
When I run the app in simulator again, now the background color of view_config is transparent.
您的超级视图是否具有清晰的颜色,然后将其更改为黑色它将解决您的问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.