1
我想发布广告。我希望广告位于UITableView
之内。随机在常规内容中。我UITableView
容易填充这样的:Swift/UITableView将随机行插入部分以发布AdMob广告
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return example.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("newEventsCell", forIndexPath: indexPath) as! ExampleCell
return cell
}
如何走私UITableViewCell as! AdCell
随机进入的UITableView?非常感谢帮助。
例如像:
[regular content]
-------------------------
[ ad cell ]
-------------------------
[regular content]
-------------------------
[regular content]
-------------------------
[regular content]
-------------------------
[ ad cell ]
-------------------------
[regular content]
-------------------------
下面是一个示例代码的图片,它给出了同一个表视图的两种不同单元格类型,这里我的条件是只是为了测试,然后它是indexPath.row == 1我在你的canse中使用Ad Cell,另一种情况是我使用了正常的单元格类型。 [链接](https://dl.dropboxusercontent.com/u/24078452/Screen%20Shot%202016-09-24%20at%203.06.31%20PM.png) –
我今天试试你的解决方案 –
这样得到你直...我使用我当前的数组“TestArray”(fe),填充我想要的内容。并将Ad元素添加到此数组中?你能提供任何类型的代码,让你的想法更容易理解吗? –