我的tableview中有原生广告,并使用此索引路径显示:
indexPath.row - Int(indexPath.row/adRowStep)
如何更改didSelectRowAtIndexPath函数以使用上述indexPath?
修改
这是来自cellForRowAtIndexPath func
的代码override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! NearMeCell
let venue = venues[indexPath.row - Int(indexPath.row/adRowStep)]
let venueTittle = (venue["Name"] as! String)
cell.venueName.text = venueTitle
return cell
}
这是原生广告的代码:
func configureAdManagerAndLoadAds() {
if adsManager == nil {
adsManager = FBNativeAdsManager(placementID: "adID", forNumAdsRequested: 2)
FBAdSettings.addTestDevice("clientID")
adsManager.delegate = self
adsManager.loadAds()
}
}
答案 0 :(得分:0)
我仍然不了解广告的展示方式,但根据您提供的信息,我希望您在didSelectRowAtIndexPath
let venue = venues[indexPath.row + Int(indexPath.row/adRowStep)]