Я создал ViewController А (он же VCA) и VCB встраивание в навигации View Controller, отображение контроллер зрения ребенка в раскадровке как classes.mНе удается оттеснить для просмотра контроллера встраивания в навигации контроллере
Когда я пытаюсь построить этот перенаправлять зрения контроллера A-> B-> A или создать VCA от VCB, используя:
A :
PairViewController * sliderVC = [self.storyboard instantiateViewControllerWithIdentifier:@"PairViewController"];
sliderVC.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:sliderVC animated:NO completion:nil];
sliderVC.view.backgroundColor = [UIColor clearColor];
B : ViewController *destinationController = [self.storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[destinationController setBle:_ble];
[destinationController setLeDevice:selectedDevice];
destinationController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:destinationController animated:NO completion: nil] ;
новый А создается без появилась любой навигационной панели.
При использовании
[self.navigationController pushViewController:destinationController animated:nil];
Xcode говорит, за исключением;
Cannot call pushNavigationItem:animated: directly on a UINavigationBar managed by a controller.'
могли бы вы сказать мне, как создать VCA от VCB, с моей пользовательской панели навигации сохраняя нетронутыми, не хватает?
В А Я пытаюсь построить навигационную панель в этом методе, но навигация оказывается ноль, если создание VCA от VCB
-(void)viewWillLayoutSubviews{
navigationBar= [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
}
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:NO];
navigationBar = self.navigationController.navigationBar;
[navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName,
[UIFont fontWithName:@"TitilliumText22L-Medium" size:22.0], NSFontAttributeName,
nil] ];
UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"FPV Control"];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 20)];
[button setImage:[UIImage imageNamed:@"menu_back.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
// UIBarButtonItem *buttonItemA = [[UIBarButtonItem alloc] initWithCustomView:button];
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self action:@selector(buttonClicked:)];
[leftBarButtonItem setCustomView:button];
navigationItem.leftBarButtonItem = leftBarButtonItem;
UIButton *buttonA = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 70, 20)];
[buttonA setImage:[UIImage imageNamed:@"rc_logo.png"] forState:UIControlStateNormal];
UIBarButtonItem *buttonItemB = [[UIBarButtonItem alloc] initWithCustomView:buttonA];
navigationItem.rightBarButtonItem = buttonItemB;
[navigationBar pushNavigationItem:navigationItem animated:NO];
NSLog(@" navigaytion item : %@" , navigationItem);
NSLog(@" navigaytion bar : %@" , navigationBar);
Можете ли вы рассказать мне, что такое точный поток контроля представления, который вы собираетесь? например: aViewcontroller> (модель) bViewController> (push) aViewController – DilumN
aViewcontroller: presentViewController to bViewcontroller bViewcontroller: presentViewController to aViewcontroller // [self presentViewController: destinationController animated: NO completion: nil]; –
только модели, не толкает –