[英]set the view of iphone view controller
I want to add a UIViewController on my current UIView on a button click event. 我想在按钮单击事件上在当前UIView上添加一个UIViewController。 But I am not able to set the frame.
但是我无法设置框架。 How can I set the y-axis of view.
如何设置y轴视图。 I also checked out iPhone: How to set UIViewController frame?
我还签出了iPhone:如何设置UIViewController框架? but I can't solve it.
但是我解决不了
GalleryViewController *objgallery = [[GalleryViewController
alloc]initWithNibName:@"GalleryViewController" bundle:[NSBundle mainBundle]];
objgallery.view.frame = CGRectMake(0, 88, 320, 372);
[self presentModalViewController:objgallery animated:YES];
If you are trying to present a modal view that is smaller than the screen, I fear that this is not the way presentModalViewController
works. 如果您试图呈现一个小于屏幕的模式视图,我担心这不是
presentModalViewController
工作方式。 It will always try and enforce its own animation/geometry. 它将始终尝试并强制执行自己的动画/几何形状。
The only way you have to go that I can think of, is creating your own (non-modal) view and then animate it to the position you like. 我能想到的唯一的方法就是创建自己的(非模态)视图,然后将其设置为所需的位置。 Something along the lines of:
类似于以下内容:
[self.view addSubview: objgallery.view];
[objgallery.view setFrame:CGRectMake(0, 480, 320, 372)];
[UIView animateWithDuration:0.5
animations:^{
[objgallery.view setFrame:CGRectMake(0, 88, 320, 372)];
}
completion:^(BOOL finished){
}];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.