ios - 在同一个 ViewController 上转换 View
<p><p>我正在尝试在同一个 ViewController 上翻转过渡,我有一个用于触发过渡的按钮。当我通过翻转转换按下按钮时,我想更改主题颜色。 </p>
<p>我使用了这个代码部分:</p>
<pre><code>- (IBAction)changeThemeButtonTapped:(id)sender
{
int tempThemeColor = [integerForKey:@"themeColor"];
if (tempThemeColor == 10) {
;
[UIView transitionFromView:self.view
toView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
completion:^(BOOL finished) {
NSLog(@"finished");
}];
}else{
;
[UIView transitionFromView:self.view
toView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromRight
completion:^(BOOL finished) {
NSLog(@"finished");
}];
}
}
</code></pre>
<p>当我按下按钮时, View 变为黑色。有什么办法吗?我的错误是什么?
感谢您的回答和关注。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我找到了我的问题的答案。</p>
<pre><code>if (tempThemeColor == 10) {
;
[UIView transitionWithView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
} completion:^(BOOL finished) {
}];
}else{
;
[UIView transitionWithView:self.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
} completion:^(BOOL finished) {
}];
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 在同一个 ViewController 上转换 View ,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/23285651/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/23285651/
</a>
</p>
页:
[1]