开发者

How do I add a fullscreen view in Cocoa touch?

开发者 https://www.devze.com 2022-12-22 20:06 出处:网络
In开发者_C百科side the titleView of a UINavigationBar, there is a button. Clicking it should slide in a view from the top of the screen.

In开发者_C百科side the titleView of a UINavigationBar, there is a button. Clicking it should slide in a view from the top of the screen.

Where do I have to place the view so it's displayed fullscreen and not only inside the current UIViewController's contentView?

Is there a function for adding fullscreen views?


It sounds like you want a modal view or you need to load an entirely new view all together.

If you add a view to another view as a subview it must be contained in the superviews bounds. There is no way to make a subview larger than its containing view.

A modal view can completely overlay any other views on the screen but it is not part of the view hierarchy. These are used for operations such as alerts or for sheets to fetch a specific piece of information related to view underneath.

If you need to completely obscure the original view, you need to load the other view and its view controller. Use a navigation controller to manage the views. By altering the transition, you can create the illusion that you are sliding sideways to another view, flipping to the back of the first view etc.


Adding the view to the key window works.

[[[UIApplication sharedApplication] keyWindow] addSubview:(UIView *)subview];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号