【发布时间】:2011-06-23 07:31:25
【问题描述】:
在我的应用委托中,我使用performSelecorInBackground:withObject 执行我的updateData 方法。最后,会发布一条通知,告诉我的 tableview 中的观察者重新加载数据。
我的问题在于动画:使用下面的代码,我的动画从方法的末尾开始,而不是直接在 performSelector 之后。
这与选择器的背景有关还是我没有看到其他什么?
任何帮助将不胜感激。
谢谢!
- (void) updateData: (NSString *)newVersionNumber {
... CODE ...
UIView *update = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 360, 20)];
update.backgroundColor = [UIColor blackColor];
[self.navController.view addSubview:update];
[self performSelector:@selector(updateDownAnimation) withObject:nil];
... CODE ...
[[NSNotificationCenter defaultCenter] postNotificationName:@"tableviewShouldReload" object:nil];
... CODE ...
[self performSelector:@selector(updateUpAnimation) withObject:nil];
}
- (void) updateDownAnimation {
[UIView animateWithDuration:0.3 animations:^{
_window.frame = CGRectOffset(_window.frame, 0, 20);
}];
}
【问题讨论】:
标签: iphone ios cocoa-touch core-animation