2016-09-20 18 views
0

私はUIViewControllerを表示しています。UIViewControllerとそれに続くUIView(MyTopView)です。 Xcode 8では、 "Intital deviceを選択する"プロンプトが表示されたら、UIViewは正しく表示されていません。UIViewController's View。Xcode 8:UIViewがサブビューとして機能していません

これは私のUIViewControllerです。また

は、_viewTopは

enter image description here

をMyTopViewを保持するコンテナの図であり、そしてこれは私のUIView(MyTopView)ViewControllerviewWillAppear方法で enter image description here

、ある

_myTopView = (MyTopView *)_viewTop; 

NSLog(@"_myTopView: %@", _myTopView); 
NSLog(@"self.view: %@", self.view); 

しかし、

(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSAutoresizingMaskLayoutConstraint:0x608000089560 h=-&- v=-&- UIView:0x7fc4c0408da0.height == MyTopView:0x7fc4c0604780.height - 832 (active)>", 
    "<NSLayoutConstraint:0x608000088a20 V:|-(20)-[UIView:0x7fc4c0409c90] (active, names: '|':UIView:0x7fc4c0408da0)>", 
    "<NSLayoutConstraint:0x608000088ed0 V:[UIView:0x7fc4c0409c90]-(20)-| (active, names: '|':UIView:0x7fc4c0408da0)>", 
    "<NSLayoutConstraint:0x608000087df0 MyTopView:0x7fc4c0604780.height == 150 (active)>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x608000088ed0 V:[UIView:0x7fc4c0409c90]-(20)-| (active, names: '|':UIView:0x7fc4c0408da0)> 

を警告UIView(MyTopView)

_myTopView: <MyTopView: 0x7f9f5b5089f0; frame = (0 0; 625 832); autoresize = RM+BM; layer = <CALayer: 0x6080002230c0>> 
self.view: <UIView: 0x7f9f5b5084f0; frame = (0 0; 414 736); autoresize = W+H; layer = <CALayer: 0x608000223080>> 

制約のために間違ったフレーム私はUIViewのはそののViewControllerの表示部分に表示されますことを期待していました。

これは、Xcode7のealrierバージョンで動作するために使用されました。 UIView(MyTopView)の初期化中にどこか

答えて

0

、指定init -methodに好ましいのは、false/NOにそのtranslatesAutoresizingMaskIntoConstraints -propertyを設定します。

Ex。

- (instancetype) initWithCoder: (NSCoder*) aCoder 
{ 
    if (!(self = [super initWithCoder: aCoder])) return nil; 

    self.translatesAutoresizingMaskIntoConstraints = NO; 

    return self; 
} 
関連する問題