Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Affecting Z Order for UIImageView

Anyone know how to programmatically set the z order of UIImageViews? The order of instancing them will bring the last one instanced closest to the screen front, but how can it be changed at runtime?

Thanks // :)

like image 214
Spanky Avatar asked Sep 01 '09 04:09

Spanky


People also ask

What is the difference between UIImage and UIImageView?

UIImage contains the data for an image. UIImageView is a custom view meant to display the UIImage . Save this answer.

What is UIImageView in Swift?

A view that displays a single image or a sequence of animated images in your interface.

What is Calayer in Swift?

An object that manages image-based content and allows you to perform animations on that content.

What is Z index in Swiftui?

The zIndex() modifier helps to control the display order of overlapping views. It takes a value parameter that represents the relative front-to-back ordering for a view and the default value is 0. This implies, a view with a greater zIndex value would be displayed on top of views with lesser zIndex value.


1 Answers

You can use the following if the UIImageView is already a subview:

  • bringSubviewToFront
  • sendSubviewToBack

or any of the following if you're inserting the UIImageView as a subview:

  • insertSubview:atIndex
  • insertSubview:aboveSubview
  • insertSubview:belowSubview
like image 115
CiNN Avatar answered Sep 25 '22 10:09

CiNN