重绘视图关闭屏幕 - 包含选取器视图和工具栏 [英] redraw view off screen - contains picker view and tool bar
本文介绍了重绘视图关闭屏幕 - 包含选取器视图和工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图绘制/放置一个视图(包含一个选择器视图和一个工具栏在屏幕外)。在启动时,尽管在viewDidLoad中更改了坐标,View仍然在屏幕上。
Im trying to draw/place a view (which contains a picker view and a toolbar offscreen). On launch the View is still on the screen despite changing its coordinates in viewDidLoad.
self.pickerViewContainer.frame = CGRectMake(0, 722, 320, 207);
我正在使用故事板。我在故事板中创建了视图,在视图控制器中可见。我想我可以按照上面的坐标在屏幕上重绘它。
Im using the storyboard. I have created the view in the storyboard, visible in the view controller. I thought i could redraw it off screen as per coordinates above.
推荐答案
使用自动布局时在 viewDidLayoutSubviews
中写下您的视图框架相关代码这是一个解决方案
When you use Auto layout write your view's frame related code in viewDidLayoutSubviews
Here is a solution
-(void) viewDidLayoutSubviews
{
self.pickerViewContainer.frame = CGRectMake(0, 722, 320, 207);
}
这篇关于重绘视图关闭屏幕 - 包含选取器视图和工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文