1. 배경색 주기
CGContextRef ctx=UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(ctx, 05.f, 0.5f, 0.5f, 0.9f);
CGContextFillRect(ctx, CGRectMake(5, headHeight-28,self.frame.size.width,30 ));
2. 이미지 백그라운드 패턴식으로 주기
UIView *mainTitle = [[UIView alloc] initWithFrame:CGRectMake(5, headHeight-28, 320, 30 )];
mainTitle.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"car_bar.png"]];
3. 이미지 주기
UIImageView *mainTitle = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"car_bar.png"]] autorelease];
mainTitle.frame = CGRectMake(5, headHeight-28, mainTitle.frame.size.width,mainTitle.frame.size.height);
[self addSubview:mainTitle];
4. CGContextDrawImage 사용하기
CGContextRef ctx=UIGraphicsGetCurrentContext();
UIImage *c = [UIImage imageNamed:@"car_bar.png"];
CGImageRef cRef = CGImageRetain(c.CGImage);
CGContextDrawImage(ctx, CGRectMake(5, headHeight-28,c.size.width, c.size.height+1), cRef);
[c drawInRect:CGRectMake(5, headHeight-28,c.size.width, c.size.height+1)];