Hi all,
I'm using activity indicator view in my app.
When I click on a button, I want the activity indicator to display in the navigation bar for 10 seconds then automatically hide.
I'm using the following code in view did load:
CGRect frame = CGRectMake(0.0, 0.0, 25.0, 25.0);
self.activity = [[UIActivityIndicatorView alloc]
initWithFrame:frame];
[self.activity sizeToFit];
self.activity.autoresizingMask =
(UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin);
UIBarButtonItem *loadingView = [[UIBarButtonItem alloc] initWithCustomView:self.activity];
loadingView.target = self;
self.navigationItem.rightBarButtonItem = loadingView;
And in the button action I only start the indicator:
[self.activity startanimating];
But I cannot see the indicator in navigation bar.
Please tell me if there are any problems in my code...