Reputation: 1213
I have problem with Activity Indicator… if i am set the frame of Indicator is show the black background behind UIActivity indicator. and if i not set frame its look well but not in proper position. now how can i set Indicator to proper position?
Upvotes: 1
Views: 4128
Reputation: 2205
Addind to @Raj answer.
Rather than calculating 'w' and pasing them in CGPointMake
, you can use bound property.
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[indicator startAnimating];
indicator.center = CGPointMake(CGRectGetMidX(yourView.bounds), CGRectGetMidY(yourView.bounds));
[yourView addSubview:indicator];
Upvotes: 1
Reputation: 1213
Its work well with this code..
activityIndicator=[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[activityIndicator setCenter:CGPointMake(w/2-5,w/2-5)];
[activityIndicator setContentMode:UIViewContentModeCenter];
[activityIndicator startAnimating];
[self addSubview:activityIndicator];
Upvotes: 10