Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put activityindicator middle of a tableview

I have put activity indicator

 spinner.center = CGPointMake( [UIScreen mainScreen].bounds.size.width/2,[UIScreen mainScreen].bounds.size.height/2);
[self.view addSubview:spinner];

But this is not properly centered in the table view. Because table view can scroll. How can i put a spinner in the center of the screen.

like image 261
Susitha Avatar asked Aug 01 '13 04:08

Susitha


3 Answers

try with bellow code:-

    spinner.center = CGPointMake( [UIScreen mainScreen].bounds.size.width/2,[UIScreen mainScreen].bounds.size.height/2);
    yourAppdelegateClass *appDelegate = (yourAppdelegateClass*)[[UIApplication sharedApplication] delegate];
    [appDelegate.window addSubview:spinner];

Code Output is:-

enter image description here

like image 67
Nitin Gohel Avatar answered Nov 14 '22 04:11

Nitin Gohel


Try this:

spinner.center = tableview.center;

Hope it Helps!!

like image 22
Armaan Stranger Avatar answered Nov 14 '22 04:11

Armaan Stranger


I think you should add your indicater(Spinner) on table view instead of sel.view. and define the area frame on the indicater.

hope this will help you.

like image 1
iOS Rocks Avatar answered Nov 14 '22 02:11

iOS Rocks