스토리 보드를 사용하지 않지만 전통적인 xibs를 사용하는 응용 프로그램이 있습니다. 그리고 iPhone6 / +에 적용 할 때 한 뷰 컨트롤러의 뷰를 다른 viewController의 뷰의 하위 뷰로 추가하면 크기가 조정되지만 그렇지 않아야한다는 것을 알았습니다.서브 뷰 추가시 자동 크기 조정
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
{
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window!.rootViewController = ViewController(nibName:"ViewController", bundle : NSBundle.mainBundle())
self.window?.makeKeyAndVisible();
return true
}
class SubViewController: UIViewController
{
override func viewDidLoad()
{
self.view.frame = UIScreen.mainScreen().bounds
println("viewDidLoad view. frame\(self.view.frame) screen bounds \(UIScreen.mainScreen().bounds)")
// => viewDidLoad view. frame(0.0,0.0,320.0,568.0) screen bounds (0.0,0.0,320.0,568.0)
}
class ViewController: UIViewController
{
var subViewController : SubViewController?
override func viewDidLoad()
{
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.subViewController = SubViewController(nibName:"SubViewController", bundle : NSBundle.mainBundle())
self.view.addSubview(self.subViewController!.view)
println("super view. frame\(self.view.frame) screen bounds \(UIScreen.mainScreen().bounds)")
//=>super view. frame(0.0,0.0,600.0,600.0) screen bounds (0.0,0.0,320.0,568.0)
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
내가 XCode6 GM과 iOS8의 GM을 사용 : 내가 지금 여기에이 문제를 재현하는 테스트 응용 프로그램을 만들었습니다
몇 가지 코드입니다. subViewController의 viewWillAppear에서 프레임을 설정하면 확인을 설정하지만 여전히 이러한 동작의 원인을 파악하고 싶습니까?
[self.view setAutoresizingMask:UIViewAutoresizingNone];
나의 제안은 내가있는 viewDidLoad에서 다른보기로 내 하위 뷰를 추가 할 때이 있다고 잘못 :