में UIActivityindicatorView जोड़ना मैं एक UIAlertView बनाना चाहता हूं जो कहता है कि "... प्रगति पर है"। यह भी दिखाएगा कि UIActivityindicator इसे देखें। क्या आप मुझे बता सकते हैं कि मैं यह कैसे कर सकता हूं?UIAlertView
धन्यवाद।
में UIActivityindicatorView जोड़ना मैं एक UIAlertView बनाना चाहता हूं जो कहता है कि "... प्रगति पर है"। यह भी दिखाएगा कि UIActivityindicator इसे देखें। क्या आप मुझे बता सकते हैं कि मैं यह कैसे कर सकता हूं?UIAlertView
धन्यवाद।
यह बहुत आसान है। बस UIActivityIndicatorView बनाएं और इसे UIAlertView के उप-दृश्य के रूप में जोड़ें।
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" " message:@" " delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView *progress= [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)];
progress.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
[alert addSubview:progress];
[progress startAnimating];
[alert show];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.center = CGRectMake(xcords, ycords, width, height);
[alert addSubview:spinner];
[spinner startanimating];
[alert show];
इस स्पिनर AlertView की खारिज पर छिपा हो जाता है।
[alert dismissWithClickedButtonIndex:0 animated:YES];
मेरे मामले में मैंने पाया कि हार्डकोडेड फ्रेम उत्पत्ति का उपयोग करना क्या बुरा है। और अगर मेरे संदेश में एक पंक्ति है, तो संकेतक मेरे संदेश के शीर्ष दिखा रहा है।
तो मैं सूचक नये नोट्स के साथ समारोह का सृजन करता है, तो आकार UIAlertView
+(UIAlertView*) progressAlertWithTitle:(NSString*) title andMessage:(NSString*) message andDelegate:(id)delegate{
UIAlertView *progressAlert = [[UIAlertView alloc] init];
[progressAlert setTitle:title];
[progressAlert setMessage:message];
[progressAlert setDelegate:delegate];
UIActivityIndicatorView *progress=nil;
progress= [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[progressAlert addSubview:progress];
[progress startAnimating];
[progressAlert show];
progress.frame=CGRectMake(progressAlert.frame.size.width/2-progress.frame.size.width, progressAlert.frame.size.height-progress.frame.size.height*2, progress.frame.size.width, progress.frame.size.height);
return progressAlert;
}
इस मामले में, सूचक हमेशा केंद्र द्वारा
एक पंक्ति संदेश:
अधिक एक पंक्ति संदेश:
धन्यवाद, यह काम करता है। – ebaccount
यह बहुत अच्छा जवाब है, लेकिन मुझे आश्चर्य है कि अगर कोई बटन नहीं है तो मैं इसे दृश्य से कैसे खारिज कर सकता हूं? –
[अलर्ट खारिज WithClickedButtonIndex: 0 एनिमेटेड: हाँ]; –