iphone - UIActivityIndicatorView not displaying right on UIAlertView -


I am writing an iOS app, and I have to display a UILartview with the spinner. Sometimes , something goes wrong when I try to add the spinner to the center of the warning, usually when there was another warning before the one (not exactly the rule, but it is I saw that it fails).

I partially solved this bug with delay in the construction of the spinner. This code is hidden in view:

  Warning = [[ [UIAlertView Alloc] initWithTitle: @ "Loading ..." Message: Nil Representative: Cancel CancelTutton: Any other buttonsTitts: No] AutoWrecks]; [Alerts show]; [Self display selector: @Selector (with adpinner) WithObject: After zero: 0.5F];   

and this is my adpinner function:

  - (zero) adpinner {UIActivityIndicatorView * indicator2 = [[UIActivityIndicatorView alloc] InitWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge]; Pointer 2 Center = CP point make (alert.bound.edit.width/2, warning.bound.height - 50); [Pointer 2 initialization]; [Warning addSubview: Pointer 2]; [Release 2 indicator]; }   

This solution is working all the time, but I do not like how it is done. Although the above warning is not being troubled despite more than half the spinner being shown, but there should be a better way of handling this. I am not an expert in IOS, nor am I a senior programmer, but can not I use an event? Something like this when "Warnings are actually displayed, go to addSpinner function"? I do not know how to do this, and not much help on the web ...

Hope someone can help me! Thank you.

You can use it instead.

And within the warning for the spinner, you can use these methods.

  - (zero) startuploading {alert = [[UIAlertView alloc] initWithTitle: @ "" Message: @ "Please Wait ..." Representative: Cancel CancelTutton: Any other button titles: zero] ; UIActivityIndicatorView * Progress = [[UIActivityIndicatorView alloc] initWithFrame: CGRectMake (125, 50, 30, 30)]; Progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; [Warning addSubview: progress]; [Start-up progress]; [Progress continues]; [Alerts show]; } - (zero) stop loading {[Lucky button dismissed with warning: Animated: 0 Animated: Yes]; [Warning issued]; }    

Comments