我正在尝试调整属于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; }
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);
这是我的头脑,但我想稍微调整它会做你想要的.
原文地址:https://www.jb51.cc/c/117829.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。