views:

99

answers:

3

Hi i am not able to add uiactivity indicator in uitableview controller, can someone help me out

I am having a table view controller now on click event of cell in table i want to display activity indicator because on click event of cell it takes 3 to 4 second of processing , so i want to display activity indicator at that time but when i drag and drop activity indicator on tableview controller it does allow me to add that so i am confused how to add that activity indicator

thansk in advance..

A: 

Do you have it wired up properly to the controller class in IB? Where are you trying to display it? How are you doing it in the code? These are things that would be helpful to know...

Geoff Baum
For some reason I can't comment on the answer below. This goes with that: Why don't you overlay a view on top of the table and make it hidden until the user clicks a cell. Then reveal it with an activity indicator. Or maybe you could put one in a toolbar or something. That's also a nice alternative.
Geoff Baum
thanks i tries this and it worked
mrugen
+1  A: 

Why dont you add it programatically in your cell's accesory view?

Martha
no its not on each cell it is like that whenever user clicks on any cell i just wanted to display activity indicator at the centre of my table view contoller and not in each cell ...
mrugen
Then I think you should add a transparent UIView to the tableview with the activity indicator in the middle. That should be quite straightforward.
Martha
ya i was thinking of that only anyways thanks for your inputs.
mrugen
A: 

You can use this code:

UIActivityIndicatorView* activityIndicator = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge] autorelease];

activityIndicator.center = yourTableView.center;

[activityIndicator startAnimating];

[yourTableView addSubview: activityIndicator];

top stop it simply use

[activityIndicator removeFromSuperview];
activityIndicator = nil;
Kostiantyn Sokolinskyi