나는 같은 문제를 다루는 데 시간을 할애했다. iOS8 용 모달 탐색 컨트롤러에서보기 컨트롤러를 누르면 루트 컨트롤러와 크기가 같은보기 컨트롤러가 생성되었지만 iOS7의 경우이 두 번째보기 컨트롤러는 모달 폼 시트 (540.f, 620.f)의 기본 크기를 가졌습니다. . 유일한 작업 솔루션, 나는 두 iOS7에 대한 지금까지 가지고 올 수 있고 iOS8의는 다음과 같다 : ViewController1을 제시
ViewController1.m
@interface ViewController1()
@end
@implementation ViewController1
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.view.superview.bounds = CGRectMake(0, 0, VC1_WIDTH, VC1_HEIGHT);
}
- (void)nextTapped:(id)sender {
ViewController2 *vc2 = [storyboard instantiateViewControllerWithIdentifier:@"ViewController2"];
[self.navigationController pushViewController:vc2 animated:NO];
// call after push
self.navigationController.view.superview.bounds = CGRectMake(0, 0,VC2_WIDTH,VC2_HEIGHT);
}
@end
:
ViewController1 *vc1 = [storyboard instantiateViewControllerWithIdentifier:@"ViewController1"];
UINavigationController *navVC = [[UINavigationController alloc] initWithRootViewController:vc1];
navVC.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:navVC animated:NO completion:nil];
ViewController2.m
을
#import "ViewController2.h”
@interface ViewController2()
@end
@implementation ViewController2
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.view.superview.bounds = CGRectMake(0, 0, VC2_WIDTH, VC2_HEIGHT);
}
- (void)nextTapped:(id)sender {
ViewController3 *vc3 = [storyboard instantiateViewControllerWithIdentifier:@"ViewController3”];
[self.navigationController pushViewController:vc3 animated:NO];
self.navigationController.view.superview.bounds = CGRectMake(0, 0,VC3_WIDTH,VC3_HEIGHT);
}
- (void)backTapped:(id)sender {
self.navigationController.view.superview.bounds = CGRectMake(0, 0,VC1_WIDTH,VC1_HEIGHT);
[self.navigationController popViewControllerAnimated:NO];
}
@end
ViewController3.m
#import "ViewController3.h”
@interface ViewController3()
@end
@implementation ViewController3
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.view.superview.bounds = CGRectMake(0, 0, VC3_WIDTH, VC3_HEIGHT);
}
- (void)backTapped:(id)sender {
self.navigationController.view.superview.bounds = CGRectMake(0, 0,VC2_WIDTH,VC2_HEIGHT);
[self.navigationController popViewControllerAnimated:NO];
}
@end
모달 탐색 컨트롤러에 푸시 된보기 컨트롤러에 텍스트 입력 필드를 추가하는 경우 iOS8의 경우 키보드 표시 및 해제가 자동으로 잘못된 크기로 조정됩니다. 불행히도이 문제에 대한 적절한 수정이 아직 없습니다.
navigationController? .preferredContentSize = CGSize (width : preferredContentSize.width, height : preferredContentSize.height)를 viewWillAppear에서 설정하여 텍스트 필드 문제를 수정할 수 있습니다. –