Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a view from subviews on top of its superview?

I have a mainViewController and inside its nib file I added an info button, in which action is to flip between two subviews, subview A and subview B.

From mainViewController, under viewDidLoad, I'm inserting subview A. Here I notice that the info button is in front of the subview A, which is fine.

The problem comes that when pressing any buttons that are located within subview A's nib file, in which they add new subviews, the info button remains on front.

So, how can I add these later subviews on front of all parent view stacks, so the info button does not appear? or how can I hide the info button?

like image 577
Ole Media Avatar asked Feb 25 '23 21:02

Ole Media


1 Answers

You can put subview infront of everything else by calling

[view bringSubviewToFront:subview];

You can hide the button (or any other UI element) by calling it's setHidden function like so:

[button setHidden:YES];
like image 71
detra83 Avatar answered Mar 25 '23 01:03

detra83