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];
}
タブは機能していますが、私はこれらの警告が表示されないので、おそらくより良い方法があります。
よろしく、 スティーブン
おかげで、私は次のコードに入れて: - (無効)タブバー:(UITabBar *)タブバーdidSelectItem:(UITabBarItem *)のTabItem { \tのNSLog(tabItem.tag、 "あなたは、選択した%dを持っています" @)。 }しかし、どのタブをタップしても、NSlogは常にtabItem.tagを0としています。 – Stephen
IBでタグを設定していますか? – MarkPowell
ありがとう、私はそれを設定していなかった。完了しました。 – Stephen