简体   繁体   中英

iOS development: guaranteed top layer

Is it possible to programmatically (not via xib) add a button or other control on an arbitrary iOS app which is always on top? I want to make a bit more advanced screenshot app where the developer has to put (preferably) one line of code in his app which will show a button in the left top (for instance) and when the user clicks that it screenshots and opens a layer which, again, is guaranteed on top to enter some information and share via Twitter.

Can that be done and how?

You could either just make sure to call:

[self.view bringSubviewToFront:topView];

Or possibly add it to you app delegate window:

AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
[[delegate window] topView];

Note: this will be on top of all views in every view controller until you remove it.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM