ios子视图在模拟器中显示为倒置

Tec*_*raT 0 subview core-plot ios

我在uiview子类中创建了一个活动指示器和一个标签,并在许多不同的tab中调用它.除了Graph Hosting视图(CPTGraphHostinView)之外,它在我调用它的大多数地方都能正常工作.在这个特定的视图中,subView看起来是颠倒的.标签位于微调器上方.我尝试使用imageview而不是标签,并使用相同的倒置图像.

这是我的initWithframe方法

- (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;
}
Run Code Online (Sandbox Code Playgroud)

这里是对activityIndi​​cator的调用,在视图中加载了

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

    [ob_activityobject showInView:self.view];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Eri*_*och 5

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

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