I'm using objective-c in my project. I want to show a new UIViewController (for example A) with navigation bar this is my codes:
AViewController *AVC = [[AViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController: AVC];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:nav animated:YES completion:nil];
after that when user tap on a specific UIButton, I push a new UIViewController (for example B) with this codes:
BViewController *BVC = [[BViewController alloc]init];
[self.navigationController pushViewController: BVC animated:YES];
inside B viewController I want to show a UIView in center of screen, this is my codes:
UIView *someView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];
someView.backgroundColor = [UIColor redColor];
CGFloat x = self.view.center.x;
CGFloat y = self.view.center.y;
someView.center = CGPointMake(x, y);
[self.view addSubview:someView];
this is my problem, the someView not showing in center of device, why this is happening and how to resolve my problem?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…