只能说太神奇了,完美应用到我的毕业设计
- (UIImage*) createImageWithColor: (UIColor*) color { CGRect rect=CGRectMake(0,0,self.view.bounds.size.width,64); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return theImage; }
与UIpagecontrol所控制的子视图配合使用,如果你的navigationBar的背景颜色要与子视图一致,那么使用以上方法会达到美妙的效果