のサブクラスを作成し、それをUIView
と呼びましたMSMobileControlView
。UIView
Autolayout 対応のストーリーボードにオブジェクトを追加し、そのクラスを に割り当てましたMSMobileControlView
。
内部MSMobileControlView
には次のコードがあります。
-(void)didMoveToSuperview
{
NSLog(@"self.frame: %@", NSStringFromCGRect(self.frame));
UIBUtton *levelButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[levelButton setFrame:CGRectMake(0, 0, 150, 40)];
[levelButton setTitle:@"Next Level" forState:UIControlStateNormal];
[self addSubview:levelButton];
}
NSLog
出力は次のとおりです。
self.frame: {{0, 0}, {0, 0}}
ただし、画面にはまだビューが表示され、ボタンは期待どおりにタップに反応します。に関連付けられている他のコードはありませんMSMobileControlView
。何が起こっている?