嗨M在添加标签方面遇到问题.M通过在循环内传递数组静态添加标签并设置x& y轴的位置...通过彩色图像数组和标签数组..这里M倒置标签和彩色图像..问题可能是..down是代码:
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];
}
答案 0 :(得分:0)
核心情节托管视图是self.view
吗?如果是这样,请不要向其添加任何子视图。而是在顶部创建一些视图层次结构,其中包含某种容器视图。添加主机视图以及标签和按钮作为容器视图的子视图。