0
작동하지 않습니다 그래서 내 코드입니다 :UIView의 애니메이션
- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 0) {
if (!header) {
header = [[CustomBackground alloc] initWithFrame:CGRectMake(0, 0, 320, 30)];
float number = [self.total floatValue];
[self updateTotalLabel: &number];
}
return header;
}
return nil;
}
-(void)updateTotalLabel:(float *)amount
{
float currentValue = [self.total floatValue];
self.total = [NSNumber numberWithFloat:(currentValue + *amount)];
[header updateLabel:[NSString stringWithFormat:TOTAL, [total floatValue]]];
}
헤더 updateLabel : 나는 updateTotalLabel, 사용자가있는 tableview에 새로운 레코드를 추가 할 때마다 호출 오전
-(void)updateLabel:(NSString *)string
{
CGRect frame = self.frame;
frame.origin.y = -frame.size.height;
[UIView animateWithDuration:0.5
delay:0.1
options: UIViewAnimationCurveEaseOut
animations:^{
self.frame = frame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
self.frame = frame;
frame.origin.y = 0;
self.label.text = string;
[UIView animateWithDuration:0.5
delay:1.0
options: UIViewAnimationTransitionCurlDown
animations:^{
self.frame = frame;
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
[label setNeedsDisplay];
}
. 애니메이션은 첫 번째 호출 updateLabel 이후에만 작동하기 때문에 애니메이션에 문제가 있습니다. 각 애니메이션 트리거가있는 경우 출력에 YT
당신이 볼 수
편집
이 좋아, 그래서 나는 영화를 레크 리 에이션.
확인, 업데이트 됨) – juantorena