【问题标题】:Text and image blur when I flip the view翻转视图时文本和图像模糊
【发布时间】:2016-11-09 13:09:33
【问题描述】:

我有一个应用程序,我需要在其中水平翻转 UIView(180 度)。此 UIView 还包含 UILabelUIImageView

我使用这段代码翻转 UIView 并再次翻转 UILabel 和 UIImageView 以避免镜像效果。

-(void)rotateSearchView:(UIView *)searchView{

    searchView.layer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);
    searchView.frame = CGRectIntegral(searchView.frame);
    for(UIView *view in searchView.subviews){

        view.layer.transform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);
        view.frame = CGRectIntegral(view.frame);
        if([view isKindOfClass:[UITextField class]]){

            UITextField *lbl = (UITextField *) view;
            [lbl setTextAlignment:NSTextAlignmentRight];
        }
    }
}

但是现在 UILabel 中的文字和 UIImageView 中的图像是模糊的。

任何建议

【问题讨论】:

  • 你为什么要触摸 searchView 子视图?
  • 搜索视图是我自定义创建的。

标签: ios objective-c uiview uiimageview catransform3d


【解决方案1】:

您首先翻转名为“searchView”的超级视图。然后翻转该超级视图的所有子视图。超级视图的翻转也使子视图难以翻转。试着只翻转你的超级视图。

【讨论】:

  • 是的,第一次翻转也翻转了子视图,但是文本和图像被反转了,所以为了让它们恢复原来的形式,我需要再次翻转子视图
猜你喜欢
  • 1970-01-01
  • 2017-10-02
  • 1970-01-01
  • 1970-01-01
  • 2011-09-23
  • 1970-01-01
  • 1970-01-01
  • 2012-10-28
  • 1970-01-01
相关资源
最近更新 更多