I want to move one view on top of another, how can I know the z index of the view, and how to move on to top?
You can use the zPosition
property of the view's layer (it's a CALayer
object) to change the z-index of the view.
theView.layer.zPosition = 1;
As Viktor Nordling added, "big values are on top. You can use any values you want, including negative values." The default value is 0.
You need to import the QuartzCore framework to access the layer. Just add this line of code at the top of your implementation file.
#import "QuartzCore/QuartzCore.h"