mercredi 25 février 2015

How to manage MobAd in tableViewCell in swift

I am working with project in swift.I need to use Google MobAd in tableView, I manage Ad in cell but Ad is show fine in iPhone 5, iPhone6 and iPhone 6 plus but in iPhone 4s Ad is show in another cell for few second. When we scroll tableView ad is hide and working fine.


How to fix this problem in iPhone 4s.I am using this code for show cell and Ad



func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

var cell:ArticleTableViewCell? = tableView.dequeueReusableCellWithIdentifier("ArticleCell") as? ArticleTableViewCell

if (cell == nil) {
var nib:NSArray=NSBundle.mainBundle().loadNibNamed("ArticleTableViewCell", owner: self, options: nil)

cell = nib.objectAtIndex(0) as? ArticleTableViewCell
}


if indexPath.row % 6 == 1 {


if ((self.adView.superview) == nil) {

self.adRequest()
}
cell.addSubview(self.adView)


}

cell.imageView.image = UIImage(data: NSData(contentsOfURL: NSURL(string: "http://ift.tt/1wqW3bg")!)!)
return cell!
}



Aucun commentaire:

Enregistrer un commentaire