简体   繁体   English

取消UITableViewController会更改ADBannerView位置

[英]Dismissing UITableViewController changes ADBannerView location

I have set ADBannerView in last of UITableViewController it's working perfectly when have same view, but when I go to another view and dismiss it adview size changes. 我已经在UITableViewController的最后一个中设置了ADBannerView ,当拥有相同的视图时,它可以完美地工作,但是当我转到另一个视图并关闭它时,adview大小会发生变化。

here is code 这是代码

override func scrollViewDidScroll(scrollView: UIScrollView) {
    let tableBounds = tableView.bounds
    var bannerFrame = self.bannerView.frame

    bannerFrame = CGRect(x: tableBounds.origin.x, y: tableBounds.origin.y + CGRectGetHeight(tableBounds) - CGRectGetHeight(bannerFrame), width: tableBounds.size.width, height: bannerFrame.size.height)
    bannerView.frame = bannerFrame
}

Before 之前

在此处输入图片说明

After

在此处输入图片说明

Try replacing 尝试更换

let tableBounds = tableView.bounds

with

let tableBounds = tableView.frame

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM