更改UIViewController self.view框架 [英] Change UIViewController self.view frame

查看:167
本文介绍了更改UIViewController self.view框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试显示一个viewController xib视图,其视图显示在固定标题横幅(0,0,320,44)下,这是在应用程序窗口中添加的imageView。



<这是因为我需要它在我导航多个视图控制器时粘在屏幕上。这是我正在做的项目的要求。



到目前为止,我已经尝试过:




  • 使用点表示法和setter将XIB视图调整为适当的帧大小(0,0,320,416)。


  • 更改框架viewDidLoad with self.view.frame = CGRectMake(0,44,320,416);




但它不是加工。有什么建议?

解决方案

中设置框架viewWillAppear

   - (void)viewWillAppear:(BOOL)动画
{
self.view.frame = CGRectMake(0,44 ,320,416);
[super viewWillAppear:animated];
}


I am trying to display a viewController xib view with its view displayed under a fixed header banner (0,0,320,44) which is an imageView added on Application window.

This is because I need it to stick on the screen while I navigate multiple view controllers. Its a requirement of the project I am doing.

So far I have tried:

  • Resizing the XIB view to the appropriate frame size (0,0,320,416), both with dot notation and setter.

  • Changing the frame in viewDidLoad with self.view.frame = CGRectMake(0, 44, 320, 416);

but it is not working. Any suggestion?

解决方案

Set the frame in viewWillAppear

- (void)viewWillAppear:(BOOL)animated
{
     self.view.frame = CGRectMake(0, 44, 320, 416);
    [super viewWillAppear:animated];
}

这篇关于更改UIViewController self.view框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆