objective-c – 调整UIView的大小

我正在尝试调整属于tapjoy SDK的UIView实例的大小.

这是代码

- (UIView*)showFeaturedAppFullScreenAd:(Nsstring*)adURL withFrame:(CGRect)frame
{
    UIView *fullScreenAdView = nil;

    [self moveViewToFront];

    [self.view setAlpha:1];

    fullScreenAdView = [TJCFeaturedAppViewHandler showFullScreenAdWithURL:adURL withFrame:frame];
    [self.view addSubview:fullScreenAdView];

    return fullScreenAdView;
}

我尝试在上面的方法添加自己的setter方法

fullScreenAdView.frame = CGRectOffset(fullScreenAdView.frame,50,500);

但是当我运行它时,它对tapjoy广告没有任何影响.

我的问题是:我正在尝试调整此实例的大小,以便不占用100%的设备窗口,而是占用(比方说)70%.

我有一些想法如何做到这一点,但它们是模糊的(比如写fullScreenAdView = [mainScreen * 0.7f),但我希望有人会有更具体的想法.

编辑:这是我的情况的超级高科技图片.
http://i207.photobucket.com/albums/bb289/teh_Mac/tjAd-1.jpg

这是我到目前为止提出的原型方法

fullScreenAdView.frame = CGRectMake(0,[mainScreen * 0.7f],[mainScreen * 0.7f];

解决方法

为什么不使用CGRectMake并将其作为superview的百分比?
float percentage = .7f;  //whatever you like
int xPosition = fullScreenAdView.superview.frame.size.width * ((1 - percentage) / 2);
int yPosition = fullScreenAdView.superview.frame.size.height * ((1 - percentage) / 2);

int width = fullScreenAdView.superview.frame.size.width * (1 - percentage);
int height = fullScreenAdView.superview.frame.size.height * (1 - percentage);

fullScreenAdView.frame = CGRectMake(xPosition,yPosition,width,height);

这是我的头脑,但我想稍微调整它会做你想要的.

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...