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

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.
Last updated:4/25/2016 1:41:00 AM

1 Answers

Tarun Kumar
Tarun Kumar

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.