की प्रस्तुति के समान पॉप एनीमेशन बनाना, मैं यूआईएलर्टव्यू - एक पॉप/वसंत के समान तरीके से एक दृश्य प्रस्तुत करना चाहता हूं। दुर्भाग्य से UIAlertView subclassing दृश्य के लिए एक विकल्प नहीं है जिसे मुझे पेश करने की आवश्यकता है। मैंने कुछ कोड लिखा है, लेकिन मुझे यह यथार्थवादी नहीं लगता है जितना मैं चाहूंगा। मैं अधिक यथार्थवाद या किसी लिंक के लिए किसी भी सुझाव की सराहना करता हूं यदि कुछ भी ऐसा ही किया गया है (मुझे Google पर कुछ भी नहीं मिला)। धन्यवाद।UIAlertView
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.backgroundColor = [UIColor whiteColor];
v = [[UIView alloc] initWithFrame:CGRectMake(140, 140, 60, 60)];
v.backgroundColor = [UIColor blueColor];
[self addSubview:v];
[self animate];
}
return self;
}
- (void)animate {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:0.2];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(popStep1Complete)];
v.frame = CGRectMake(90, 90, 140, 140);
[UIView commitAnimations];
}
- (void)popStep1Complete {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:0.15];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(popStep2Complete)];
v.frame = CGRectMake(110, 110, 100, 100);
[UIView commitAnimations];
}
- (void)popStep2Complete {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDuration:0.15];
v.frame = CGRectMake(100, 100, 120, 120);
[UIView commitAnimations];
}
यह कहां जाता है? मेरे मूल दृश्य या मेरे UIAlertView में? – Moshe
'UIView' का कोई उप-वर्ग। इस मामले में कस्टम 'UIAlertView' जैसी कक्षा। – zoul
एनीमेशन के चारों ओर दूसरी बार फायरिंग नहीं थी, नील कुंजी सेट करने के लिए मेरे लिए समस्या तय की गई: [self.view.layer addAnimation: एनीमेशन forKey: nil]; – amleszk