Resize UIView

I am trying to resize an instance of a UIView that is part of the tapjoy SDK.

here is the code:

- (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; } 

I tried adding my own setter method in the above method:

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

But this did not affect the tapjoy ad when I launched it.

My question is this: I'm trying to resize this instance so that instead of taking 100% of the device’s window, it takes 70%.

I have some ideas on how to do this, but they are vague (for example, write fullScreenAdView = [mainScreen * 0.7f), but I was hoping someone would come up with more specific ideas.

edit: here is a super, high-tech picture of my situation. http://i207.photobucket.com/albums/bb289/teh_Mac/tjAd-1.jpg

This is the proto method that I have come up with so far:

 fullScreenAdView.frame = CGRectMake(0,0, [mainScreen * 0.7f], [mainScreen * 0.7f]; 
+7
source share
1 answer

Why don't you use CGRectMake and do it as a percentage of the supervisor?

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

It’s written off my head, but I think with a little tweak it will do what you want.

+5
source

All Articles