0

每当 iAd 从顶部向下滚动时,我都会尝试调整应用程序视图的大小。问题是在运行时,当我设置相关视图的调整大小的帧大小时,调整大小不会发生 9因此 iAd 绘制在前 50 个垂直像素的顶部)。

如果我在设计时设置 UIView 大小,那么我会看到视图已调整大小(当我运行应用程序时)。

那么我在运行时做错了什么导致我无法调整大小?

我的控制器的 NIB 的结构如下所示:

> > View

>   > View (associated with IB 'contentView')

>     > CustomView (UIView)

>        - ScrollView

>        - Toolbar (top)

>        - Toolbar (bottom)

在代码中,adBannerView 是这样添加的: [self.view addSubView:adBannerView];

conteView 的 origin.y 和 size.height 是我正在更新的内容(使其 y = 50,并且高度 = 原始高度 - 50)。这应该按比例缩小,以便有足够的空间来显示顶部的横幅(高度为 50 像素)。

4

2 回答 2

0

你确定视图不为零吗?你在 Interface Builder 中连接了它吗?如果您在视图上调用-setFrame并且没有发生任何事情,则视图可能无效。

于 2010-07-29T18:24:15.277 回答
0

I resolved my issue, though in a work-around way. I think the problem was that my view layout tree was quite complicated. Ex, i had a scrollviewer within a custom UIView. The scrollviewer was adding a UIView as its content at run-time. And on top of all this I was trying to resize various views.

But for some reason, the view(s) never managed to be bottom-justified (its always top-justified).

于 2010-08-02T03:07:47.100 回答