objective-c - 如何呈现完全一样的 View ?

标签 objective-c ios ipad uipopovercontroller modalviewcontroller

如何完全像这样呈现 View Controller 。我的意思是前面的密码 View 。

我知道如何创建 View ,但不知道如何呈现它。

enter image description here

最佳答案

我使用 UIPopoverController 实现了这样的屏幕.像这样的东西:

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:content];
UIView *root = [UIApplication sharedApplication].keyWindow;
CGRect frame = root.frame;
frame.origin = CGRectCenter(frame);
frame.size = CGSizeMake(1, 1);

[popover presentPopoverFromRect:frame inView:root permittedArrowDirections:0 animated:YES];

框架是屏幕的中心点。为箭头方向传递 0 可防止通常的箭头出现在弹出框上。 content是您希望显示的 View Controller 。

关于objective-c - 如何呈现完全一样的 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13444194/

相关文章:

objective-c - 如何创建不同宽度和高度的平铺照片库?

objective-c - 如何有条件地将框架包含在 Xcode 项目中?

ios - 如何从NSMutableArray获取NSMutableArray

ios - 扩展 UILocalNotification

ios - Xcode 4.2 中的 retainCount 发生了什么?

objective-c - iOS Pong 开发,碰撞检测

ios - 如何在谷歌地图 iOS 中到达目的地时获得通知

iphone - 符号化崩溃日志时如何从系统框架(例如 UIKit)添加符号?

objective-c - 强制 Controller 更改纵向或横向方向

iphone - 用于 iOS 开发的 Objective-C++