1. 程式人生 > >簡單實現UIActivityIndicatorView上新增文字

簡單實現UIActivityIndicatorView上新增文字

- (void)webViewDidStartLoad:(UIWebView *)webView{
    if (myAlert==nil){ 
       myAlert = [[UIAlertView alloc] initWithTitle:nil 
                                                              message: @"正在載入資料,請稍候..."
                                                                delegate: self  
                                                 cancelButtonTitle: nil f
                                                 otherButtonTitles: nil];
     UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; 
     activityView.frame = CGRectMake(120.f, 48.0f, 37.0f, 37.0f);   
     [myAlert addSubview:activityView]; 
     [activityView startAnimating]; 
     [myAlert show]; 
}
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{  
      [myAlert dismissWithClickedButtonIndex:0 animated:YES]; 
}