Handling Events On Admob UICollectionView - ios

fairly new to Admob. I've been trying to implement AdMob native ads on UICollectionView but I've had little to no luck. I've been able to load and show the ad in a cell but events are not registered e.g views or clicks with the GADNativeAdDelegate. This is the code so far:
// In main view controller
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "exampleCell", for: indexPath) as! exampleCell
let myItem = myItemList[indexPath.item]
if myItem is GADNativeAd {
let nAd = myItems as! GADNativeAd
let nibView = Bundle.main.loadNibNamed("UnifiedNativeAdView", owner: nil, options: nil)?.first
let nativeAdView = nibView as! GADNativeAdView
// Prepare ad content
let nativeAd = nAd
// Add content to native view
(nativeAdView.headlineView as? UILabel)?.text = nativeAd.headline
nativeAdView.mediaView?.mediaContent = nativeAd.mediaContent
(nativeAdView.bodyView as? UILabel)?.text = nativeAd.body
nativeAdView.bodyView?.isHidden = nativeAd.body == nil
(nativeAdView.iconView as? UIImageView)?.image = nativeAd.icon?.image
nativeAdView.iconView?.isHidden = nativeAd.icon == nil
(nativeAdView.advertiserView as? UILabel)?.text = nativeAd.advertiser
nativeAdView.advertiserView?.isHidden = nativeAd.advertiser == nil
nativeAdView.callToActionView?.isUserInteractionEnabled = false
nativeAdView.nativeAd?.delegate = self
nativeAdView.nativeAd?.rootViewController = self
cell.addSubview(nativeAdView)
return cell
}
}
My cell is a basic UICollectionViewCell that is empty as follows:
class exampleCell: UICollectionViewCell {
override func awakeFromNib() {
super.awakeFromNib()
}
}
I've had a look at this answer but it doesn't seem to be applicable.

In cellForItemAt delegate
try this
// Remove previous GADBannerView from the content view before adding a new one.
for subview in reusableAdCell.contentView.subviews {
subview.removeFromSuperview()
}

Related

How to display ad in uitableview admob swift?

I am very new to admob nativeads and I checked every tutorial
online on how to add ads in tableview, but I did not find any luck
This is the code I have so far in my cellforrowat function:
let cell = Bundle.main.loadNibNamed("NativeAdTableViewCell", owner: self, options: nil)?.first as! NativeAdTableViewCell
print("ad = \(ad == nil)")
cell.adTitle.text = ad?.headline
cell.adSubtitle.text = ad?.body
cell.img.image = ad?.icon?.image
cell.selectionStyle = UITableViewCell.SelectionStyle.none
return cell
Other code:
func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADUnifiedNativeAd) {
nativeAd.delegate = self
ad = nativeAd
}
Thank you in advanced
You can simply add an empty element in your tableView dataSource array when receive your add like below:
func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADUnifiedNativeAd {
nativeAd.delegate = self
self.yourDataSource.insert("", at: 0) // add empty element in where you show your ads
ad = nativeAd
yourTableView.reloadData()
}
After that your tableViewCell look like :
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let data = self.yourDataSource[indexPath.row]as? [String]
if data == nil {
let nativeAd = self.ad //Your native ads object
nativeAd.rootViewController = self
let cell = tableView.dequeueReusableCell(withIdentifier: "nativecell", for: indexPath)as! nativecell // nativecell is your native ad cell
let adView = cell.adview
adView!.nativeAd = nativeAd
cell.headline.text = nativeAd.headline
cell.icon.image = nativeAd.icon?.image
cell.body.text = nativeAd.body
cell.action.isUserInteractionEnabled = false
cell.action.setTitle(nativeAd.callToAction, for: UIControl.State.normal)
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "regularCell", for: indexPath)as! regularCell
return cell
}
}
Thanks

How to display xib in current collection view

This is my first time working with Google AdMob native ads, I believe I followed the implementation instruction.. All that is left is actually displaying the ads within the collection view, and this is where I am stuck. I do not know how to correctly display the Ads in between users uploaded post. Basically I need help adding a xib to a collection view. task: Ads should be populating while scrolling through posts..
I am using
Collection View
Xib
Google AdMob Native advanced
I also do not receive any errors or crashes, and the console prints so I am obviously doing something wrong.. Received native ad:
The console also - print("Ads not dispalying ") and print("Not what I want")
Heres my code
import UIKit
import Firebase
class FollowingFeedViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UISearchBarDelegate, FeedCellDelegate, PeopleToFollowDelegate, GADUnifiedNativeAdLoaderDelegate {
// MARK: - Google ADMob
/// The ad unit ID from the AdMob UI.
let adUnitID = "ca-app-pub-3940256099942544/3986624511"
/// The number of native ads to load (between 1 and 5 for this example).
let numAdsToLoad = 5
/// The native ads.
var nativeAds = [GADUnifiedNativeAd]()
/// The ad loader that loads the native ads.
var adLoader: GADAdLoader!
func adLoaderDidFinishLoading(_ adLoader: GADAdLoader) {
addNativeAds()
}
func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADUnifiedNativeAd) {
print("Received native ad: \(nativeAd)")
// Add the native ad to the list of native ads.
nativeAds.append(nativeAd)
}
func adLoader(_ adLoader: GADAdLoader, didFailToReceiveAdWithError error: GADRequestError) {
print("\(adLoader) failed with error: \(error.localizedDescription)")
}
/// Add native ads to the list.
func addNativeAds() {
if nativeAds.count <= 0 {
print("Ads not dispalying ")
return
}
let adInterval = (posts.count / nativeAds.count) + 1
var index = 0
for nativeAd in nativeAds {
if index < collectionObject.count {
collectionObject.insert(nativeAd, at: index)
index += adInterval
} else {
print("Not what I want")
break
}
}
}
// MARK: - Properties
var posts = [Post]()
var collectionObject = [AnyObject]()
var viewSinglePost = false
var post: Post?
var currentKey: String?
var userProfileController: ProfileViewController?
var header: FeedReusableView?
#IBOutlet weak var collectionView: UICollectionView!
// MARK: - UICollectionViewDataSource
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if posts.count > 4 {
if indexPath.item == posts.count - 1 {
fetchPosts()
}
}
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return posts.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "PostsCell", for: indexPath) as? FollowingCell {
cell.delegate = self
cell.post = posts[indexPath.item] as Post
handleUsernameLabelTapped(forCell: cell)
handleMentionTapped(forCell: cell)
handleHashtagTapped(forCell: cell)
return cell
} else {
let nativeAd = collectionObject[indexPath.row] as! GADUnifiedNativeAd
nativeAd.rootViewController = self
let nativeAdCell = collectionView.dequeueReusableCell(withReuseIdentifier: "UnifiedNativeAdCell", for: indexPath)
// Get the ad view from the Cell. The view hierarchy for this cell is defined in
let adView : GADUnifiedNativeAdView = nativeAdCell.contentView.subviews
.first as! GADUnifiedNativeAdView
// Associate the ad view with the ad object.
// This is required to make the ad clickable.
adView.nativeAd = nativeAd
adView.mediaView?.mediaContent = nativeAd.mediaContent
// Populate the ad view with the ad assets.
(adView.headlineView as! UILabel).text = nativeAd.headline
(adView.advertiserView as! UILabel).text = nativeAd.advertiser
(adView.bodyView as! UILabel).text = nativeAd.body
adView.bodyView?.isHidden = nativeAd.body == nil
(adView.iconView as? UIImageView)?.image = nativeAd.icon?.image
adView.iconView?.isHidden = nativeAd.icon == nil
// In order for the SDK to process touch events properly, user interaction
// should be disabled.
adView.callToActionView?.isUserInteractionEnabled = false
return nativeAdCell
}
}
// MARK: - ViewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
// // Google Admob
let options = GADMultipleAdsAdLoaderOptions()
options.numberOfAds = numAdsToLoad
// Prepare the ad loader and start loading ads.
adLoader = GADAdLoader(adUnitID: adUnitID,
rootViewController: self,
adTypes: [.unifiedNative],
options: [options])
collectionView.dataSource = self
collectionView.delegate = self
adLoader.delegate = self
adLoader.load(GADRequest())
self.collectionView.register(UINib(nibName: "NativeAdCell", bundle: nil), forCellWithReuseIdentifier: "UnifiedNativeAdCell")
addNativeAds()
}
#objc func handleRefresh() {
posts.removeAll(keepingCapacity: false)
self.currentKey = nil
fetchPosts()
collectionView?.reloadData()
header?.profilesCollectionView.reloadData()
}
}
Fetch Post
func fetchPosts() {
guard let currentUid = Auth.auth().currentUser?.uid else { return }
if currentKey == nil {
USER_FEED_REF.child(currentUid).queryLimited(toLast: 5).observeSingleEvent(of: .value, with: { (snapshot) in
self.collectionView?.refreshControl?.endRefreshing()
guard let first = snapshot.children.allObjects.first as? DataSnapshot else { return }
guard let allObjects = snapshot.children.allObjects as? [DataSnapshot] else { return }
allObjects.forEach({ (snapshot) in
let postId = snapshot.key
self.fetchPost(withPostId: postId)
})
self.currentKey = first.key
})
} else {
USER_FEED_REF.child(currentUid).queryOrderedByKey().queryEnding(atValue: self.currentKey).queryLimited(toLast: 6).observeSingleEvent(of: .value, with: { (snapshot) in
guard let first = snapshot.children.allObjects.first as? DataSnapshot else { return }
guard let allObjects = snapshot.children.allObjects as? [DataSnapshot] else { return }
allObjects.forEach({ (snapshot) in
let postId = snapshot.key
if postId != self.currentKey {
self.fetchPost(withPostId: postId)
}
})
self.currentKey = first.key
})
}
}
func fetchPost(withPostId postId: String) {
Database.fetchPost(with: postId) { (post) in
self.posts.append(post)
self.posts.sort(by: { (post1, post2) -> Bool in
return post1.creationDate > post2.creationDate
})
self.collectionView?.reloadData()
}
}
}
I think this will work, you have two data source as I can see from your code
var posts = [Post]()
var collectionObject = [AnyObject]()
and you want to create cell for all of them but the only data source you are going to show is posts based on your code
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return posts.count
}
this can be solved by changing your code to something like this
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 2
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
if (section == 0) {
return posts.count
} else {
return collectionObject.count
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if (indexPath.section == 0) {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "PostsCell", for: indexPath) as FollowingCell
cell.delegate = self
cell.post = posts[indexPath.item] as Post
handleUsernameLabelTapped(forCell: cell)
handleMentionTapped(forCell: cell)
handleHashtagTapped(forCell: cell)
return cell
} else {
let nativeAd = collectionObject[indexPath.row] as! GADUnifiedNativeAd
nativeAd.rootViewController = self
let nativeAdCell = collectionView.dequeueReusableCell(withReuseIdentifier: "UnifiedNativeAdCell", for: indexPath)
// Get the ad view from the Cell. The view hierarchy for this cell is defined in
let adView : GADUnifiedNativeAdView = nativeAdCell.contentView.subviews
.first as! GADUnifiedNativeAdView
// Associate the ad view with the ad object.
// This is required to make the ad clickable.
adView.nativeAd = nativeAd
adView.mediaView?.mediaContent = nativeAd.mediaContent
// Populate the ad view with the ad assets.
(adView.headlineView as! UILabel).text = nativeAd.headline
(adView.advertiserView as! UILabel).text = nativeAd.advertiser
(adView.bodyView as! UILabel).text = nativeAd.body
adView.bodyView?.isHidden = nativeAd.body == nil
(adView.iconView as? UIImageView)?.image = nativeAd.icon?.image
adView.iconView?.isHidden = nativeAd.icon == nil
// In order for the SDK to process touch events properly, user interaction
// should be disabled.
adView.callToActionView?.isUserInteractionEnabled = false
return nativeAdCell
}
}
This code first add posts and then start adding your adds.
Check this and let me know if it's worked or not. If this show the cell then you can mix two data source together and populate your collection view cells with condition like if you create new object that math this condition with your current object posts & collectionObject
if indexPath.item % 4 == 0 {
show adds
} else {
show posts
}
Hope this will help
Your FollowingFeedViewController is not a subclass from UICollectionViewController, right? Because of that, you should set the delegate and dataSource properties of your collectionView instance.
Probably something like this:
override func viewDidLoad() {
super.viewDidLoad()
collectionView.delegate = self
collectionView.dataSource = self
}
It looks like at least some of your code is missing. I can't see a fetchPosts method.
I note that handleRefresh calls fetchPosts just before reloadData. Does fetchPosts load the data synchronously or asynchronously? If it loads the data asynchronously, reloadData will be called before the data is ready.
Similarly for the ads. I can't see any reloadData (or equivalent) calls to the collection view once the ads are ready. If you post your full code it'll be easier to diagnose the problem.

Swift - Array - Remove a value

It might be a simple question, but I am struggling to find a solution and I am blocked :(
I am working on a CollectionView which displays a list of avatars with their profile pictures. I am trying to add them on a Array when you select it and remove it when you deselect it.
This is my code and I have tried a lots of things but it doesn't work
Function when a cell is selected
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let cell2 = collectionV.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! SelectFriendCollectionViewCell
let cell5 = self.collectionV.cellForItem(at: indexPath) as? SelectFriendCollectionViewCell
let Friends_avatarname = (cell5?.avatarUsername_Outlet.text! as? String!)!
let Friends_UID = (cell5?.avatarUID_Outlet.text! as? String!)!
let Friend = FriendsSelectArray(avatarUID: (Friends_UID as! String?)!, avatarname: (Friends_avatarname as! String?)!)
self.FriendsSelect.append(Friend)
print ("Friend added :\(Friend.avatarname)")
}
Function if cell deselected
func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
let cell2 = collectionV.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! SelectFriendCollectionViewCell
let cell5 = self.collectionV.cellForItem(at: indexPath) as? SelectFriendCollectionViewCell
let Friends_avatarname = (cell5?.avatarUsername_Outlet.text! as? String!)!
let Friends_UID = (cell5?.avatarUID_Outlet.text! as? String!)!
var Friend = FriendsSelectArray(avatarUID: (Friends_UID as! String?)!, avatarname: (Friends_avatarname as! String?)!)
}
The class of the array
class FriendsSelectArray{
var avatarUID: String
var avatarname: String
init( avatarUID: String, avatarname: String){
self.avatarUID = avatarUID
self.avatarname = avatarname
}
func returnPostAsDictionary()->NSDictionary{
let postDictionary: NSDictionary = ["avatarUID": avatarUID,
"avatarname": avatarname]
return postDictionary
}
}
And my starting class of CollectionView
class SelectFriendViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate {
#IBOutlet weak var collectionV: UICollectionView!
var databaseRef: DatabaseReference!
let cellIdentifier = "cell"
var FriendsSelect : [FriendsSelectArray] = []
var selectedCell = [IndexPath]()
It works when I add (When a cell is selected), but I can't manage to remove when you deselect the cell (the specific cell you deselected)
Please, can someone help me ?
A million thanks in advance,
You should compare the IDs of friend being removed from the list with IDs of all friends and remove the one needed from array and reload the collection view.
Please check out below code and comments in code:
func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
let cell2 = collectionV.dequeueReusableCell(withReuseIdentifier: cellIdentifier, for: indexPath) as! SelectFriendCollectionViewCell
let cell5 = self.collectionV.cellForItem(at: indexPath) as? SelectFriendCollectionViewCell
let Friends_avatarname = (cell5?.avatarUsername_Outlet.text! as? String!)!
let Friends_UID = (cell5?.avatarUID_Outlet.text! as? String!)!
var Friend = FriendsSelectArray(avatarUID: (Friends_UID as! String?)!, avatarname: (Friends_avatarname as! String?)!)
// Pseudocode, remove friend from array logic.
// Compare avatarUID of friend being removed and friends in the list.
for x in (0..<FriendsSelect.count).reversed() {
if(FriendsSelect[x].avatarUID == Friend.avatarUID) {
FriendsSelect.remove(at: x)
break
}
}
// TODO: Reload array
}
Set a property in the model so that it can tell you at any instant of time whether it is selected or not. example:
class FriendsSelectArray{
var avatarUID: String
var avatarname: String
var isSeleted: Bool = false
init( avatarUID: String, avatarname: String){
self.avatarUID = avatarUID
self.avatarname = avatarname
}
func returnPostAsDictionary()->NSDictionary{
let postDictionary: NSDictionary = ["avatarUID": avatarUID,
"avatarname": avatarname]
return postDictionary
}
}
then set isSeleted = true in the didselect item and isSelected = false in itemDidDeselect method. After this you can easily filter the selected items from the rest of the items in the array.

How to display dynamically data from Server in CollectionViewCell in TableViewCell with swift3?

I got my json link data from TableViewCell , and then retrieve that data from server and display in collectionView with related TableViewCell data.
How to display this data in swift3? Please, help me.
I got url link (mainThemeList.main_associated_url,main_name) from TableViewCell.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let mainThemeList = mainHomeThemeTable[(indexPath as NSIndexPath).row]
let cell = tableView.dequeueReusableCell(withIdentifier: "homecell") as! HomeCategoryRowCell
DispatchQueue.main.async {
cell.categoryTitle.text = mainThemeList.main_name
cell.mainAssociatedURL.text = mainThemeList.main_associated_url
self.prefs.set(mainThemeList.main_name, forKey: "main_name")
cell.categoryTitle.font = UIFont.boldSystemFont(ofSize: 17.0)
cell.collectionView.reloadData()
}
DispatchQueue.main.async {
self.retrieveDataFromServer(associated_url: mainThemeList.main_associated_url,main_name: mainThemeList.main_name)
}
return cell
}
And then data related url link data from Server.
private func retrieveDataFromServe(associated_url : String , main_name: String) {
SwiftLoading().showLoading()
if Reachability().isInternetAvailable() == true {
self.rest.auth(auth: prefs.value(forKey: "access_token") as! String!)
rest.get(url: StringResource().mainURL + associated_url , parma: [ "show_min": "true" ], finished: {(result : NSDictionary, status : Int) -> Void in
self.assetsTable.removeAll()
if(status == 200){
let data = result["data"] as! NSArray
if (data.count>0){
for item in 0...(data.count) - 1 {
let themes : AnyObject = data[item] as AnyObject
let created = themes["created"] as! String
let assets_id = themes["id"] as! Int
let name = themes["name"] as! String
var poster_img_url = themes["poster_image_url"] as! String
let provider_id = themes["provider_id"] as! Int
poster_img_url = StringResource().posterURL + poster_img_url
self.assetsTable.append(AssetsTableItem(main_name: main_name,created: created,assets_id: assets_id, name: name, poster_image_url: poster_img_url,provider_id: provider_id))
}
}
SwiftLoading().hideLoading()
}else{
SwiftLoading().hideLoading()
}
})
}
}
Retrieve data from Server data store in assetsTable.
And then assetsTable data display in CollectionViewCell.
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "videoCell", for: indexPath) as! HomeVideoCell
cell.movieTitle.text = list.name
cell.imageView.image = list.image
return cell
}
My problem is collectionViewCell data are duplicate with previous assetsTable data and didn't show correct data in CollectionView.
My tableViewCell show (Action, Drama) label and My CollectionViewCell show movies Name and Movie Image. I retrieve data for CollectionViewCell from server but CollectionViewCell didn't display related data.
in HomeVideoCell Subclass clean up data in prepareforreuse
override func prepareForReuse() {
super.prepareForReuse()
self.movieTitle.text = ""
self.imageView.image = nil
}

Checking if UITableViewCell is completely visible in Swift

I am using Parse to store users who have videos and then display their videos in a PFQueryTableViewController (subclasses UITableViewController I believe). I want only the video that is in the TableViewCell which is completely visible to automatically play but I'm having difficulty making the right video play. I looked for solutions but everything was in Objective-C, and my attempts to use the solutions in Swift were unsuccessful. Here is my code:
override func scrollViewDidScroll(scrollView: UIScrollView) {
var cells = self.tableView.visibleCells()
var indexPaths = self.tableView.indexPathsForVisibleRows()!
if (cells.count == 1) {
self.checkVisibilityOfCell(cells[0] as! UsersTableViewCell, forIndexPath: indexPaths[0] as! NSIndexPath)
} else if (cells.count == 2) {
self.checkVisibilityOfCell(cells[1] as! UsersTableViewCell, forIndexPath: indexPaths[1] as! NSIndexPath)
} else if (cells.count > 2) {
for i in 1...(cells.count - 1) {
(cells[i] as! UsersTableViewCell).completelyVisible = true
}
}
}
func checkVisibilityOfCell(cell : UsersTableViewCell, forIndexPath : NSIndexPath){
var cellRect : CGRect = self.tableView.rectForRowAtIndexPath(forIndexPath)
cellRect = self.tableView.superview!.convertRect(cellRect, fromView: self.tableView)
var completelyVisible : Bool = self.tableView.frame.contains(cellRect)
cell.completelyVisible = completelyVisible
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath, object: PFObject?) -> PFTableViewCell? {
var cell : UsersTableViewCell? = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as? UsersTableViewCell
if(cell == nil) {
cell = UsersTableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: cellIdentifier)
}
if let pfObject = object {
let otherUser = pfObject as! PFUser
cell?.userDisplayed = otherUser
if (cell?.completelyVisible == true) {
// Video playing
println("\(cell?.userDisplayed!.username!) is completely visible")
var video1 = pfObject["video1"] as? PFFile
let video1URL = NSURL(string: (video1?.url)!)
objMoviePlayerController = MPMoviePlayerController(contentURL: video1URL)
objMoviePlayerController.movieSourceType = MPMovieSourceType.Unknown
objMoviePlayerController.view.frame = (cell?.userVideo1.bounds)!
objMoviePlayerController.scalingMode = MPMovieScalingMode.AspectFit
objMoviePlayerController.controlStyle = MPMovieControlStyle.None
objMoviePlayerController.repeatMode = MPMovieRepeatMode.One
objMoviePlayerController.shouldAutoplay = true
cell?.userVideo1.addSubview(objMoviePlayerController.view)
objMoviePlayerController.prepareToPlay()
objMoviePlayerController.play()
} else {
println("\(cell?.userDisplayed!.username!) is not completely visible")
}
}
return cell
}
Since some videos do play, I suspect that one or both of the functions scrollViewDidScroll or checkVisibilityOfCell is incorrect. Any help would be appreciated!

Resources