How to set Activity Indicator in UITableView in Objective-C?

Total Post:7

 1201  View(s)
Rate this:
I want to display activity indicator for the initial load time for each collection view cell. So I tried to place it in the table view delegate method cellForItemAtIndexPath: and created 25 pixels above the cell for some reason.
Below is my code:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
    let cell = self.collectionView.dequeueReusableCellWithReuseIdentifier("AACollectionViewCell", forIndexPath: indexPath) as! AACollectionViewCell
    let activityView = UIActivityIndicatorView (activityIndicatorStyle: .Blue) = =

    return cell
Now, Please tell me the proper way to handle the activity indicator or what the wrong in my code..!
Thank you.
  1. Post:214

    Re: How to set Activity Indicator in UITableView in Objective-C?

    You can use which gives us the frame of contentView from its superView' coordinate system.
    User like the below example: = CGPointMake(cell.contentView.frame.size.width / 2,
                                           cell.contentView.frame.size.height / 2)
    I hope it will be helpful for you.

      Modified On Apr-11-2018 04:06:11 AM