0
내 앱에 여러 개의 탭이 있습니다. 탭은 문제없이 작동하지만 위와 같은 제목의 경고 메시지가 표시됩니다.이 경고 메시지는 제거하고 싶습니다. 내 코드는 다음과 같습니다 :'UITabBarItem'이 'SetAction'에 응답하지 않을 수 있습니다.
-(void)pressItem1:(id)sender {
[self presentModalViewController:settingsViewController animated:YES];
}
-(void)pressItem2:(id)sender {
[self presentModalViewController:infoViewController animated:YES];
}
-(void)pressItem3:(id)sender {
[self presentModalViewController:aboutViewController animated:YES];
}
-(void)viewDidLoad {
self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]];
CGRect frame = CGRectMake(0, 0, 480, 49);
UIView *v = [[UIView alloc] initWithFrame:frame];
UIImage *i = [UIImage imageNamed:@"smallMenuBackground.png"];
UIColor *c = [[UIColor alloc] initWithPatternImage:i];
v.backgroundColor = c;
[c release];
[mainTabBar insertSubview:v atIndex:0];
[v release];
[settingsBarItem setAction:@selector(pressItem1:)];
[infoBarItem setAction:@selector(pressItem2:)];
[aboutBarItem setAction:@selector(pressItem3:)];
//initialSyncSwitch = NO;
[super viewDidLoad];
}
탭이 작동하지만 더 좋은 방법이 있으므로 이러한 경고가 표시되지 않습니다.
안부, 스티븐
덕분에, 나는 다음과 같은 코드를 넣어 : - (무효) 한 tabBar : (의 UITabBar *) 한 tabBar didSelectItem : (UITabBarItem *) TabItem의 { \t NSLog (tabItem.tag, "당신이 선택한 % d 개를"@); }하지만 NSlog는 탭하는 탭에 관계없이 항상 tabItem.tag를 0으로 유지합니다. – Stephen
태그를 IB로 설정 하시겠습니까? – MarkPowell
고마워 마크, 나는 그것을 얻지 못했다. 지금 해. – Stephen