English 中文(简体)
我如何使我的单阿明旗出现在屏幕底部?
原标题:How do I make my iAd banner appear at bottom of screen?

我有以下法典允许我把它放在首位。 我希望它出现在底层。

 adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
 adView.frame = CGRectOffset(adView.frame, 0, -50);
 adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
 adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
 [self.view addSubview:adView];

任何援助都将受到赞赏。

最佳回答

Update—@larsacus pointed out this is for 4.2+:

adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
CGRect adFrame = adView.frame;
adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
adView.frame = adFrame;
[self.view addSubview:adView];

“在模拟器中工作”/

问题回答

我关于SO的第1次回答:

为什么不使用特意见的中心财产? 3. 如果你的主要观点是:

//at the bottom of view,centered
adView.center=CGPointMake(viewWidth/2, viewHeight-adView.frame.size.height);

//at the top, right corner ;)
adView.center=CGPointMake(viewWidth-adView.frame.size.width/2, adView.frame.size.height);

卡车

This is what helped me move the view to the bottom:

adFrame.origin.y = Self.view.frame.size.hviii;

adView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;

Using Storyboards, then, ignore that the standard iAd Banner View does not reach the edges of the screen. Set the iAd banner to be centred, then move it to as close to the bottom as you want. No other width settings (no leading or trailing settings)

地雷从view底部看着8个 p子,但我去了——在IAd旗帜和IDController观点之间搭配。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签