iOS7 앱에서 UINavigationBar 모양을 변경하려고합니다. 다음 집에 눌러 다시 제시하고 나의 새로운 모습입니다, 나는 그것이 표준 iOS7에의 탐색 모음입니다있는 UITableViewController을 제시 처음iOS 7 UINavigationBar 모양이 처음으로 작동하지 않습니다 ...
- (void)viewDidLoad
{
[super viewDidLoad];
m_sNumberToCall = @"";
UIBarButtonItem * btn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"IconHome.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(btHomeTouched:)];
self.navigationItem.leftBarButtonItem = btn;
self.navigationController.navigationBar.translucent = YES;
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"TVCNavBack.png"] forBarMetrics:UIBarMetricsDefault];
NSShadow * shadow = [[NSShadow alloc] init];
shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
shadow.shadowOffset = CGSizeMake(0, 1);
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0],
NSForegroundColorAttributeName,
shadow,
NSShadowAttributeName,
[UIFont fontWithName:@"Helvetica-Bold" size:21.0],
NSFontAttributeName,
nil]];
}
을하지만 : 나는 다음을 수행하고있다.
왜 처음에는 작동하지 않는 아이디어가 있습니까?
viewDidAppear에서 코드를 이동하려고 시도합니다. – Ilario
나는 그것을 시도했지만 아무 것도 시도하지 않았으며 viewWillAppear에서도 시도했습니다. – LilMoke
샘 문제가 생길 수있는 다른 사람들을 위해이 코드를 [[UINavigationBar appearance] setBa ...에서 this : [self.navigationController.navigationBar setBa ...] 및 setTitleTextAttributes 행으로 변경했습니다. 찾을 답변 : http://stackoverflow.com/questions/17361500/how-to-set-navigation-bar-image-ins-ios-7 – LilMoke