iphone - UIView 过渡动画不显示 subview
<p><p>我使用容器 View 作为两个 subview 的 superView 。我想将一个 subview “翻转”到另一个 subview 。第一个 subview 恰好是空白的,第二个 subview 是一个有一些文本的 <code>UILabel</code>。</p>
<p>翻转正在发生,但我没有看到我的 subview 。 </p>
<p>我想将 <code>blankLabelView</code> 转换为 <code>labelToTransition</code>。有任何想法吗?谢谢!</p>
<p>代码:</p>
<pre><code>-(void)viewDidLoad {
CGRect labelFrame = CGRectMake(100.0, 217.0, 125.0, 34.0);
self.labelContainerView = [ initWithFrame:labelFrame];
// If I change the background color to something other than clear
// I can see that this view is flipping, otherwise it appears that
// nothing happens.
self.labelContainerView.backgroundColor = ;
;
UILabel *label = [ initWithFrame:labelFrame];
label.backgroundColor = ;
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 2;
label.textAlignment = UITextAlignmentCenter;
self.labelToTransition = label;
UIView *blankView = [ initWithFrame:labelFrame];
blankView.backgroundColor = ;
self.blankLabelView = blankView;
}
-(void)viewWillAppear {
self.labelToTransition.text = @"some text from a model object";
;
}
-(void)flipViewAnimation {
UIView *containerView = self.labelContainerView;
[UIView transitionWithView:containerView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromBottom
animations:^{
;
;
}
completion:NULL];
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p><code>UILabel</code> 的可能框架设置不正确</p>
<p>试试</p>
<pre><code>CGRect labelFrame = CGRectMake(0, 0.0, 125.0, 34.0);
</code></pre>
<p>对于翻转功能,请尝试以下代码段</p>
<pre><code>-(void)LetUsFlip
{
;
;
;
if ()
{
;
;
;
}
else
{
;
;
;
}
;
}
</code></pre></p>
<p style="font-size: 20px;">关于iphone - UIView 过渡动画不显示 subview ,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/8690829/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/8690829/
</a>
</p>
页:
[1]