---
title: "How to set Activity Indicator in UITableView in Objective-C?"  
description: "How to set Activity Indicator in UITableView in Objective-C?"  
author: "Anonymous User"  
published: 2016-04-23  
updated: 2016-04-25  
canonical: https://www.mindstick.com/forum/34113/how-to-set-activity-indicator-in-uitableview-in-objective-c  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# How to set Activity Indicator in UITableView in Objective-C?

I want to display [activity](https://www.mindstick.com/forum/12894/how-to-force-recreation-of-activity-fragment-on-restore) indicator for the initial load time for each [collection view](https://www.mindstick.com/forum/33803/how-to-set-collection-view-cell-size-in-ios) cell. So I tried to place it in the [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) [view delegate](https://www.mindstick.com/forum/33747/how-to-create-view-delegate-in-ios) [method](https://www.mindstick.com/forum/166/webservice-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)
    activityView.center = cell.myImage.center

    activityView.center = cell.contentView.center
    activityView.startAnimating()

    return cell
}
```

Now, [Please tell me](https://www.mindstick.com/forum/33900/please-tell-me-what-are-the-technique-to-content-optimization) the proper way to [handle](https://www.mindstick.com/articles/311004/suede-skillet-handle-cover) the activity indicator or what the wrong in my code..!\
Thank you.

## Replies

### Reply by Tarun Kumar

You can use cell.contentView.center which gives us the frame of contentView from its superView' coordinate system.User like the below example:

```
activityView.center = CGPointMake(cell.contentView.frame.size.width / 2,
                                       cell.contentView.frame.size.height / 2)
```

I hope it will be helpful for you.\


---

Original Source: https://www.mindstick.com/forum/34113/how-to-set-activity-indicator-in-uitableview-in-objective-c

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
