2012-02-09 7 views

답변

1

iOS5 이상 만 지원하는 경우 "모양 프록시"를 사용할 수 있습니다. a good tutorial for this이 있습니다.

이전 버전을 지원해야하는 경우 UINavigationBar의 하위 클래스를 지정하고 drawRect 메서드를 재정의해야합니다. a good sample code for this이 있습니다.

6

개체를 탐색 모음의 하위보기로 설정하려고합니다.

은 색조의 컬러 속성을 설정하거나 사용 이미지

UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:rootController]; 
controller.navigationBar.tintColor = [UIColor blackColor]; 
+1

덕분에 남자를 작동하지 u는 너무 좋은 컬러 ​​또는 사용 이미지 – NaXir

0

이 시도 :

  1. 첫째는 목표 C 클래스는 CustomNavBarUINavigationBar 클래스를 상속 말을 만들 ...
  2. 다음에이 클래스를 가져옵니다 귀하의 appDelegate ...
  3. 다음 코드 끝에서 appDelegate 클래스 ...
  4. 다음 MainWindow.xib을 열고 UINavigationBar class to CustomNavBar`을 변경하십시오.

코드 : 아이폰 OS 7에서

@implementation CustomNavBar (CustomNavBarCategory) 

-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx 
{ 

    if([self isMemberOfClass:[CustomNavBar class]]) 
    { 
     UIImage *image; 

     image=[UIImage imageNamed:@"ImageName"]; 

     CGContextClip(ctx); 
     CGContextTranslateCTM(ctx, 0, image.size.height); 
     CGContextScaleCTM(ctx, 1.0, -1.0); 
     CGContextDrawImage(ctx,CGRectMake(0, 0, self.frame.size.width, self.frame.size.height), image.CGImage); 

    } 
    else 
    {   
     [super.layer drawLayer:layer inContext:ctx];  
    } 

} 

@end 
2

이상은, 다음과 같은 시도는 :

navigationBar.barTintColor = [UIColor redColor]; 
0

엑스 코드 6.4에서 스토리 보드에서이 작업을 수행 할 수있는 방법이있다. 문서 개요에서


당신은 다른 선택할 수 있습니다 속성 관리자 변경 바 색조에서보다 탐색 모음

를 선택하고이 색상 선택기

를 가져올 것이다

드로퍼를 선택하면 이미지에서 색상을 선택할 수 있습니다.

관련 문제