1

iOSでは、ビューを回転に配置および移動しても、サブビューのUI要素(ボタンとラベル)は再描画されません。subViewはメインビューのサブビューです。

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{

    if (UIInterfaceOrientationIsPortrait(fromInterfaceOrientation)) {
        self.subView.frame = CGRectMake(0, 0, 100, 200);

    } else {
        self.subView.frame = CGRectMake(0, 0, 200, 1000);
    }

    self.subView.contentMode = UIViewContentModeRedraw;
    [self.subView setNeedsLayout];
    [UIView commitAnimations];
}

subViewのUI要素を再描画するにはどうすればよいですか?

:subViewの場所を元の場所から変更しました

4

1 に答える 1

0
[self.subView setNeedsDisplay];
于 2013-02-25T16:21:19.453 に答える