开发者

Resizing a UIView on iPhone at run-time

I'm trying to resize my app's view whenever an iAd is scrolled down from the top. The problem is that in run-time, when i set the resized frame size of the relevant view, the resizing doesnt happen 9so the iAd is draw on top of the top 50 vertical pixels).

If I set the UIView size at design-time, then I see that the view is resized (when i run the app).

So what am i doing wrong at run-time that is causing my resizing to not occur?

The structure of my controller's NIB looks like this:

> > View

>   > View (associated with IB 'contentView')

>     > CustomView (UIView)

>        - ScrollView

>        - Toolbar (top)

>        - Toolbar (bottom)

In code the adBannerView is added like this: [self.view addSubView:adBannerView];

conteView's origin.y and size.height is what im updating (to make it y = 50, and开发者_如何学C height = original height - 50). This should scale it down so that enough room is made to dispaly the banner on top (50 pixels in height).


Are you sure the view is not nil? Did you hook it up in Interface Builder? If you're calling -setFrame on the view and nothing is happening, it's likely the view is not valid.


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜