want to display UIProgressView on UIAlertView

前端 未结 6 384
挽巷
挽巷 2021-01-03 07:45

Hi guys i want to display UIProgressView on UIAlertView for displaying the processing of uploading of the file but i have searched too much and also find on that link but si

6条回答
  •  庸人自扰
    2021-01-03 08:04

    Try this code. Put YES for activity indicator and NO for progressView

    - (void) createProgressionAlertWithMessage:(NSString *)message withActivity:(BOOL)activity
    {
     progressAlert = [[UIAlertView alloc] initWithTitle: message
     message: @"Please wait..."
     delegate: self
     cancelButtonTitle: nil
     otherButtonTitles: nil];
    
    
     // Create the progress bar and add it to the alert
     if (activity) {
     activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
     activityView.frame = CGRectMake(139.0f-18.0f, 80.0f, 37.0f, 37.0f);
     [progressAlert addSubview:activityView];
     [activityView startAnimating];
     } else {
     progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(30.0f, 80.0f, 225.0f, 90.0f)];
     [progressAlert addSubview:progressView];
     [progressView setProgressViewStyle: UIProgressViewStyleBar];
     }
     [progressAlert show];
     [progressAlert release];
    }
    

提交回复
热议问题