ios子视图在模拟器中倒置显示 [英] ios sub view appears upside down in simulator

查看:219
本文介绍了ios子视图在模拟器中倒置显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在uiview子类中创建了一个活动指示器及其下方的标签,并在许多不同的选项卡中对其进行了调用.它在我所调用的大多数地方都按预期工作,除了Graph Hosting视图(CPTGraphHostinView).在此特定视图中,subView看起来是颠倒的.标签位于微调器上方.我尝试使用imageview代替label,并且使用相同的颠倒图像.

I have created an activity indicator and a label below it in a uiview sub class and calling it in many different tabs.It works as intended in most of the places i'm calling it except in Graph Hosting views(CPTGraphHostinView). In this particular view the subView appears to be upside down.The label goes above the spinner.I tried with imageview instead of label, and its the same upside down image.

这是我的initWithframe方法

Here is my initWithframe method

- (id)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];
    if (self) {
       // Initialization code.

        NSLog(@"AI: init with frame");

    spinnerView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    spinnerView.center = self.center;       
    [self addSubview:spinnerView];

    UILabel* loadingMsg = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 90.0f, 30.0f)];
    loadingMsg.center =  CGPointMake(spinnerView.center.x , spinnerView.center.y + spinnerView.bounds.size.height/2 +10);
    loadingMsg.textAlignment = UITextAlignmentCenter;
    loadingMsg.backgroundColor = [UIColor clearColor];
    loadingMsg.text = @"loading";
    [self addSubview:loadingMsg];


}
    return self;
}

这是在加载后对activityIndi​​cator的调用

Here is the call to activityIndicator in view did load

ob_activityobject = [[ActivityIndicator alloc] initWithFrame:self.view.bounds];

    [ob_activityobject showInView:self.view];

推荐答案

您不应添加其他视图作为Core Plot图托管视图的子视图.正如您所发现的,它对内容进行了翻转变换,因此可以在OS X和iOS版本之间共享相同的绘图代码.

You should not add other views as subviews of a Core Plot graph hosting view. As you've discovered, it applies a flip transform to its contents so the same drawing code can be shared between the OS X and iOS versions.

相反,将微调器设为托管视图的兄弟(即,使它们成为同一父视图的子视图).

Instead, make your spinner a sibling of the hosting view (i.e., make them subviews of the same parent).

这篇关于ios子视图在模拟器中倒置显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆