여기가 내 코드입니다. 간단 해. 내 질문은 왜 애니메이션 메인 스레드가 다른 일을 할 때, 워드 프로세서는 메인 스레드가 UI를 업데이트 할 수 있다고 말한다. 주 스레드는 같은 시간에 두 가지 일을 할 수 있습니까 ???메인 스레드가 다른 일을 할 때 애니메이션이 계속 켜짐
GPU 애니메이션을 만들 수 있습니까?
- (void)viewDidLoad {
[super viewDidLoad];
UILabel *testLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 80, 50)];
testLabel.font = [UIFont systemFontOfSize:15.0f];
testLabel.backgroundColor = [UIColor redColor];
testLabel.text = @"Hello world";
testLabel.adjustsFontSizeToFitWidth = YES;
[self.view addSubview:testLabel];
[UIView animateWithDuration:10
animations:^{
testLabel.frame = CGRectMake(100, 200, 80, 50);
} completion:^(BOOL finished) {
//
}];
[self performSelector:@selector(hello:) withObject:@"hello" afterDelay:2];
}
- (void)hello:(NSString *)hello{
for (int i = 0; i < 100000; i++) {
NSInteger j = i *5;
NSLog(@"%d",j);
}
NSLog(@"%@",hello);
}
감사합니다. 이것은 자동 그래픽 가속으로 인해 CPU 부담과 앱 속도 저하없이 높은 프레임 속도와 부드러운 애니메이션이 가능합니다. " – frank
@ 프랭크 환영합니다. 대답을 수락 할 수 있습니까? – KudoCC