iPhone:如何设置 UIViewController 框架? [英] iPhone: How to set UIViewController frame?

查看:30
本文介绍了iPhone:如何设置 UIViewController 框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个根 UIViewController,我正在添加其他 UIViewController 作为子视图.目前每个子视图都太低了(覆盖了我的自定义构建标签栏).当我尝试执行以下操作时,它不起作用:

I have a root UIViewController that I am adding other UIViewController's as subviews. Currently each of the subviews are too low down (covering up my custom build tabbar). When I try to so something like the following, it does not work:

// Test setting frame size to see if it works
self.view.frame = CGRectMake(0, 0, 200, 200);

这不会改变框架大小.

那么,我的问题是,当 UIViewController 添加为子视图后初始化时,如何设置我的框架?

推荐答案

@Nic 我认为当你添加其他视图时,你应该像这样定义其他视图的框架大小:

@Nic i think when you are adding that other view, at that time you should define the other views frame size like this:

Someviewcontroller *c = initWithNibName
c.view.frame = CGRectMake(0, 0, 200, 200);
[self addSubView:c];

我不知道这是否可行,但就是这样.

i dont know if this will work but it is something like this.

这篇关于iPhone:如何设置 UIViewController 框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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