0

I have an iAd which I want to be able to change the placement on the y axis in code. The ad is called on and spawned by this code:

- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
    [UIWebView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [banner setAlpha:1];
    [UIView commitAnimations];
}

I tried to change the position of the ad by doing something like this:

banner.frame.origin.y += 100;

or

banner.frame.origin.y = 100;

But I'm always left with the error: Expression is not assignable

tshepang
  • 12,111
  • 21
  • 91
  • 136
Mr Riksson
  • 560
  • 3
  • 10
  • 29

1 Answers1

1

You can't directly assign frame position directly on an UIView. You have to:

CGRect frame = banner.frame;
frame.origin.y += 100; //Or whatever change you want to perform.
banner.frame = frame;

If you feel curious about why this happens, check out this answer here at stackoverflow: https://stackoverflow.com/a/7074522/1152596

Community
  • 1
  • 1
The dude
  • 7,896
  • 1
  • 25
  • 50