Search code examples
iosobjective-cuiactivityviewcontroller

Why is uiactivity indicator not being shown in nav bar


UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 14, 14)];
[activityView sizeToFit];
[activityView setAutoresizingMask:(UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin)];

activityView.hidesWhenStopped = NO;

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:activityView];

[activityView startAnimating];

What is the reason the uiactivity indicator is not being shown in the top right corner? Nothing is displayed in the top right nav bar.


Solution

  • Because you not assign the color of Activity Indicator assign the color then i will show in navigation bar

    activityView.color = [UIColor blackColor];