self.view.frame = CGRectMake(0, 0, 68, 53);//设置图片的大小
UIImageView *bgImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 68, 53)];//设置图片的背景图片
bgImg.image = [UIImage imageNamed:@"1.png"];
[self.view addSubview:bgImg];
[bgImg release];
if(lab == nil)
lab = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 68, 30)];//设置图片上面的文字显示
lab.textAlignment = UITextAlignmentCenter;
lab.textColor = [UIColor blackColor];
lab.backgroundColor = [UIColor clearColor];
lab.text = [[titleArray objectAtIndex:i] objectAtIndex:0];
[self.view addSubview:lab];
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *aImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData *imageData = UIImagePNGRepresentation(aImage);
UIImage *img = [UIImage imageWithData:imageData];//生成的图片