[英]How can I present one ViewController on top of another ViewController?
Let's say I have a class that is a subclass of UIViewController
named FullSizeViewController
. 假设我有一个类,它是
UIViewController
的子类,名为FullSizeViewController
。 I also have another class that is a subclass of UIViewController
called TQHViewController
(TQH: Three Quarter Height). 我还有另一个类,它是
UIViewController
的子类,称为TQHViewController
( TQHViewController
:四分之三高度)。 How would I 我怎么会
be able to display TQHViewController
over FullSizeViewController
, with the only one quarter of FullSizeViewController
visible? 能够显示
TQHViewController
超过FullSizeViewController
,用的只有四分之一FullSizeViewController
可见?
animate this action? 动画这个动作?
I'm basically attempting to make something like a UIPopover
, but animate it so it slides in from the bottom of the screen. 我基本上是在尝试制作类似
UIPopover
东西,但是要对其进行动画处理,以使其从屏幕底部滑入。
@property(nonatomic,retain) TQHViewController *template;
template = [[TQHViewController alloc]init];
template.view.frame = CGRectMake(20, 1000, 280, 450);
And you can also set the frame for the subView and decide the size of the subview. 您还可以设置子视图的框架并确定子视图的大小。 if you want animation from the bottom use UIViewwithanimation.
如果要从底部开始动画,请使用UIViewwithanimation。
[UIView animateWithDuration:0.9f
delay:0.1f
usingSpringWithDamping:0.65f
initialSpringVelocity:0.1f
options:UIViewAnimationOptionCurveEaseOut animations:^{
template.view.frame = CGRectMake(20, 63, 280, 450);
[self.view addSubview:overlayWindow];
}
completion:^(BOOL finished) {
//Completion Block
}];
Use like this so your functionalities will not be lost and make nill after the usage. 像这样使用,这样您的功能将不会丢失,并且在使用后不会失效。
If anything wrong feel free to comment it. 如果有任何问题,请随时发表评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.