Add UIActivityIndicatorView into UIBarButton

后端 未结 6 1561
忘了有多久
忘了有多久 2021-02-01 03:00

How do I add a UIActivityIndicatorView spinner circle into a UIBarButton, so that when a user taps on one of those buttons on the navigation bar, they see a spinner while the lo

6条回答
  •  再見小時候
    2021-02-01 03:35

    Actually activity indicator is not added as toolbar item. It's a subview of current view.

    
        UIActivityIndicatorView *act = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
        [act setCenter:CGPointMake(20, 20)];
        [act startAnimating];
        [self.view addSubview:act];
    
    

    Remember to release it in -(void)dealloc.

提交回复
热议问题