2
votes

Hi M getting problem with adding labels..M adding labels statically by passing array inside a loop and setting positions of x &y-axis..m passing color images array and label array..even here M getting upside down labels and color images..wat the problem might be..down is the code:

for( int i=0;i< [PieChartColorDescriptionArray count]; i++)
    {
        UIButton* blueButton=[UIButton buttonWithType:UIButtonTypeCustom];
        [blueButton setFrame:CGRectMake(165+80,65+(40*i),10,20)];
        [blueButton setTitle:@"" forState:UIControlStateNormal];
        [blueButton setAutoresizingMask:UIViewAutoresizingFlexibleWidth ];
        [blueButton setBackgroundImage:[UIImage imageNamed:[PieChartButtonImagesArray objectAtIndex:i]] forState:UIControlStateNormal];
        [blueButton setAutoresizingMask:AUTORESIZEMASK];
        [blueButton setUserInteractionEnabled:FALSE];
        [self.view addSubview:blueButton];
        [blueButton retain];
        UILabel* loLabel1=[[UILabel alloc]initWithFrame:CGRectMake(178+80,50+(40*i),50,50)];
        [loLabel1 setBackgroundColor:[UIColor clearColor]];
        [loLabel1 setTag:101];
        [loLabel1 setTextColor:[UIColor blackColor]];
        [loLabel1 setTextAlignment:UITextAlignmentCenter];
        [loLabel1 setAdjustsFontSizeToFitWidth:NO];
        [loLabel1 setNumberOfLines:1];
        [loLabel1 setFont:[UIFont systemFontOfSize:11]];
        [loLabel1 setText:[PieChartColorDescriptionArray objectAtIndex:i]];
       //loLabel1.transform=CGAffineTransformMakeRotation(-360.0);
        [loLabel1 setAutoresizingMask:AUTORESIZEMASK];
        [self.view addSubview:loLabel1];

        [loLabel1 retain];

    }
1

1 Answers

0
votes

Is self.view the Core Plot hosting view? If so, don't add any subviews to it. Instead, create a hierarchy of views with some sort of container view at the top. Add the hosting view and your labels and buttons as subviews of the container view.