Trong phương thức viewDidLoad của tôi, tôi đặt một nút ở bên trái của chế độ xem, tắt màn hình.setFrame trong hoạt ảnh UIView không di chuyển, chỉ chụp tại chỗ
Sau đó, tôi sử dụng hai phương thức này để animate nó:
-(void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self showButton];
}
Và phương pháp:
-(void) showButton {
[myButton setTitle:[self getButtonTitle] forState:UIControlStateNormal];
// animate in
[UIView beginAnimations:@"button_in" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDone)];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationBeginsFromCurrentState:YES];
[myButton setFrame:kMyButtonFrameCenter]; // defined CGRect
[UIView commitAnimations];
}
Nút ngay lập tức xuất hiện và không sinh động. Hơn nữa, bộ chọn animationDone được gọi ngay lập tức.
Tại sao nó không hoạt ảnh nút của tôi trên màn hình?
EDIT: Đây có phải có một cái gì đó để làm với cố gắng để bắt đầu một hình ảnh động trong khi ở viewDidAppear ...
lạ nếu tôi đợi một chút, hoạt ảnh sẽ hoạt động. – TigerCoding