2
iOS 4.3 및 5.0을 모두 지원하는 앱을 개발 중입니다.탐색 모음 문제 iphone 4.3
내 코드는 5.0에서는 잘 작동하지만 4.3에서는 까다로운 버그가 발생합니다.
문제는 다음과 같습니다
내가 그것을에있는 tableView와 전망을 가지고있다. 이보기에는 왼쪽 및 오른쪽 탐색 모음 항목이 모두있는 탐색 모음이 있습니다. 일단 내가 테이블 뷰에서 행을 선택하고 (해당 뷰에 도달하면) 되돌아 와서 왼쪽 및 오른쪽 탐색 바 항목 모두 "사라집니다".
나는 지난 몇 시간 동안이 혼란을 겪었고, 어떤 사람들은 치료를 받았습니까?
이것은 이미 한 일이다
이것은 내가 때보기로드를 호출하는 유틸리티 메소드입니다.
+ (void)setNavigationBarContents:(UIViewController *)view
{
UIImage *topBarimage=[UIImage imageNamed:NAVIGATION_BAR_IMAGE];
if([view.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
[view.navigationController.navigationBar setBackgroundImage:topBarimage forBarMetrics:UIBarMetricsDefault];
}
else
{
[view.navigationController.navigationBar insertSubview:[[UIImageView alloc] initWithImage:topBarimage] aboveSubview:view.navigationController.navigationBar];
}
UIImage *logo=[UIImage imageNamed:LOGO];
UIImageView *logoView=[[UIImageView alloc]initWithImage:logo];
view.navigationItem.titleView = logoView;
UIImage *settingsButtonImage= [UIImage imageNamed:NAVIGATION_SETTINGS];
UIButton *rightBarButton = [UIButton buttonWithType: UIButtonTypeCustom];
[rightBarButton setBackgroundImage: settingsButtonImage forState:UIControlStateNormal];
[rightBarButton addTarget: view action:@selector(settingsButton:) forControlEvents:UIControlEventTouchUpInside];
rightBarButton.frame = CGRectMake(0, 0, 50, 40);
view.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: rightBarButton];
UIImage *logoutButtonImage= [UIImage imageNamed:LOGOUT];
UIButton *leftBarButton = [UIButton buttonWithType: UIButtonTypeCustom];
[leftBarButton setBackgroundImage: logoutButtonImage forState:UIControlStateNormal];
[leftBarButton addTarget: view action:@selector(logout:) forControlEvents:UIControlEventTouchUpInside];
leftBarButton.frame = CGRectMake(0, 0, 65, 32);
view.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: leftBarButton];
}
가있는 viewDidLoad 및 viewWillAppear에서, 그러나 헛되이 모두이 전화 시도했습니다.
이것은 viewController에서 이것을 호출하는 방법입니다.
- (void)viewDidLoad
{
[super viewDidLoad];
//other setups here.
[Utility setNavigationBarContents:self];
}
ViewWillAppear이 코드 [유틸리티 setNavigationBarContents : 자기] 시도 내 appDelegate.m에 이 코드를 추가하여 솔루션을 가지고; – Splendid
나는 이전에 말한 것처럼 이미 이것을 시도했다. 답장을 보내 주셔서 감사합니다. – Guru
바 버튼 항목 만 사라지거나 탐색 바가 사라집니다. – Splendid