只能说太神奇了,完美应用到我的毕业设计

- (UIImage*) createImageWithColor: (UIColor*) color
{
CGRect rect=CGRectMake(,,self.view.bounds.size.width,);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}

与UIpagecontrol所控制的子视图配合使用,如果你的navigationBar的背景颜色要与子视图一致,那么使用以上方法会达到美妙的效果

iOS开发-UIColor转UIIamge方法-LMLPHPiOS开发-UIColor转UIIamge方法-LMLPHP

04-26 15:01
查看更多