Ruu*_*ser 2 objective-c uibutton uiviewanimation ios ios-animations
我正在制作一个滑落的视图.在视图中有一个简单的UIButton.视图和按钮具有固定的宽度和高度(我通过添加颜色作为背景进行检查).虽然使用时:
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
//Slide Down the notification
CGRect notificationsRect = self.notificationContainerView.bounds;
notificationsRect.origin.y = 0;
notificationViewController.view.frame = notificationsRect;
} completion:^(BOOL finished) {
[notificationViewController didMoveToParentViewController:self];
self.currentNotification = notificationViewController;
}];
Run Code Online (Sandbox Code Playgroud)
然后视图完美地向下滑动,期望UIButton中的文本逐渐消失.它开始非常小并且动画到正确的字体大小.
如何禁用UIButton中文本的动画?
使用performWithoutAnimation:方法,然后立即强制布局,而不是以后.
[UIView performWithoutAnimation:^{
[self.myButton setTitle:text forState:UIControlStateNormal];
[self.myButton layoutIfNeeded];
}];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
641 次 |
| 最近记录: |