我正在尝试在同一个 ViewController 上翻转过渡,我有一个用于触发过渡的按钮。当我通过翻转转换按下按钮时,我想更改主题颜色。
我使用了这个代码部分:
- (IBAction)changeThemeButtonTappedid)sender
{
int tempThemeColor = [[NSUserDefaults standardUserDefaults]integerForKey"themeColor"];
if (tempThemeColor == 10) {
[self loadTheme];
[UIView transitionFromView:self.view
toView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:^(BOOL finished) {
NSLog(@"finished");
}];
}else{
[self loadTheme];
[UIView transitionFromView:self.view
toView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromRight
completion:^(BOOL finished) {
NSLog(@"finished");
}];
}
}
当我按下按钮时, View 变为黑色。有什么办法吗?我的错误是什么? 感谢您的回答和关注。
我找到了我的问题的答案。
if (tempThemeColor == 10) {
[self loadTheme];
[UIView transitionWithView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
} completion:^(BOOL finished) {
}];
}else{
[self loadTheme];
[UIView transitionWithView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
} completion:^(BOOL finished) {
}];
}
关于ios - 在同一个 ViewController 上转换 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23285651/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |