如何呈现这样的视图?

时间:2012-11-18 20:23:17

标签: objective-c ios ipad uipopovercontroller modalviewcontroller

如何呈现与此完全相同的视图控制器。我的意思是前面的密码视图。

我知道如何创建视图但不知道如何呈现它。

enter image description here

2 个答案:

答案 0 :(得分:3)

我使用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是您要显示的视图控制器。

答案 1 :(得分:1)

实施基本上是viewController,具有适当的方法。但你不需要这么一切。无需重新发明轮子。因为有一些非常漂亮的第三方库来做到这一点。退房 -

希望这会有所帮助......

相关问题