Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting only a gray color in the cell while showing in-feed ad in tableview cell. #14

Open
jaisan123 opened this issue May 30, 2018 · 0 comments

Comments

@jaisan123
Copy link

jaisan123 commented May 30, 2018

Hi, im integrating in-feed ad in a tableview.I want to show the in-feed ad after every 5 cells. Im calling the ad load method in the cellForRowAtIndexPath .But im getting only a gray color in the table cell.

 let  cell = tableView.dequeueReusableCell(withIdentifier: "adCell", for: indexPath) as! adCell
        self.refreshInMobiStrandAd()
        cell.adDescription.text = adDes
        cell.sponsored.text = adcta
       cell.name.text = adTitle
       cell.icon.image = icon
        cell.mainAd.addSubview(navtive)
        return cell

This is my ad-loading function

func refreshInMobiStrandAd() {
     
         self.InMobiNativeAd?.recyclePrimaryView()
        self.InMobiNativeAd = IMNative(placementId: 1528041596573)
        self.InMobiNativeAd?.delegate = self
        self.InMobiNativeAd?.load()
    }

Im using the delegate method as below

  var navtive = UIView()
    var adcta = ""
    var adDes = ""
    var icon = UIImage()
    var url = ""
    var adTitle = ""

    func nativeDidFinishLoading(_ native: IMNative!) {
   
        adcta = native.adCtaText
        adDes = native.adDescription
        icon = native.adIcon
        adTitle = native.adTitle
        navtive = native.primaryView(ofWidth: UIScreen.main.bounds.width)

       
    }

I'm also recycling the primary view on didEndDisplayingCell like below

 func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {

        if indexPath.row == 2 {

           self.InMobiNativeAd?.recyclePrimaryView()
        }

        else if indexPath.row == 8 {
           self.InMobiNativeAd?.recyclePrimaryView()
        }

    }

Im getting the icon,text and description loading correctly on the tableview.But im getting only a gray color in for the main ad-content which im setting on the UIView navtive variable. Where im making mistake.Please help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant