탭 막대 컨트롤러의 첫 번째보기 상단에 두 번째 탭 막대를 추가하려고하지만 어떤 이유로 맨 아래에있는 탭 막대를 제어하고 모든 것을 첫 번째 탭 버튼에 추가합니다. 나는 내가 뭘 잘못하고 있는지 볼 수 없으며 어떤 도움을 주시면 감사하겠습니다.
MainViewController *controller = self.storyboard.instantiateInitialViewController;
//************ Add Tab Bar ***********************************
self.tabsController = [[SGTabsViewController alloc] init];
self.tabsController.delegate = self;
self.window.rootViewController = self.tabsController;
[self.tabsController setToolbarHidden:NO animated:NO];
[self.tabsController addViewController:controller];
double delayInSeconds = 3.;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self.tabsController setToolbarHidden:NO animated:YES];
});
self.textTabField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 240.0, 30.0)];
self.textTabField.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.textTabField.backgroundColor = [UIColor whiteColor];
self.textTabField.borderStyle = UITextBorderStyleRoundedRect;
self.textTabField.text = @"http://www.google.com";
self.textTabField.clearButtonMode = UITextFieldViewModeAlways;
self.textTabField.keyboardType = UIKeyboardTypeURL;
self.textTabField.autocorrectionType = UITextAutocorrectionTypeNo;
self.textTabField.delegate = self;
UIBarButtonItem *urlBar = [[UIBarButtonItem alloc] initWithCustomView:self.textTabField];
UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:nil action:nil];
UIBarButtonItem *reload = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh
target:self action:@selector(reload:)];
UIBarButtonItem *add = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(add:)];
self.tabsController.toolbarItems = [NSArray arrayWithObjects:space,urlBar,space,reload,add,nil];
self.tabsController.title = @"Loading...";
탭 바를 성공적으로 생성 한 후 창에서 루트 뷰를 탭 바로 설정하십시오. 처럼
ViewController1 checkinPage=[[ViewController1 alloc]initWithNibName:@"ViewController1" bundle:nil];
checkinPage.tabBarItem.title = @"Check In";
checkinPage.tabBarItem.tag=1;
checkinPage.tabBarItem.image = [UIImage imageNamed:@"tab_ic_CheckIn.png"];
ViewController2 incentive=[[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
incentive.tabBarItem.title=@"Incentives";
incentive.tabBarItem.tag=2;
incentive.tabBarItem.image=[UIImage imageNamed:@"tab_ic_Incentives.png"];
.tabBarItem.title = @"Check In";
self.tabsController.viewControllers = [NSArray arrayWithObjects:checkinPage,incentive,nil];
self.tabBar.selectedIndex=1;
self.window.rootViewController = self.tabsController;
따라서 탭 바 생성에 대해 확인하고 올바른 위치에 추가하십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다