UIView不会自动调整子视图

时间:2013-01-24 13:31:29

标签: ios cocoa-touch uiview autoresize subviews

嘿,我的观点没有正确调整我的子视图(uibuttons)

viewDidLoad中

    UICheckbox *UICBox = [[UICheckbox alloc]init];
    [UICBox autoresizesSubviews];
    [UICBox setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin |UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleBottomMargin];
    if (!i%2) {
        [UICBox setFrame:CGRectMake(self.view.bounds.size.width/2 - CheckboxSize.width/2 - distanceToMiddle,
                                   distanceToTop + j * CheckboxSize.height + distanceBetween,
                                   CheckboxSize.width,
                                   CheckboxSize.height)];
    }
    else{
        [UICBox setFrame:CGRectMake(self.view.bounds.size.width/2 - CheckboxSize.width/2 + distanceToMiddle,
                                    distanceToTop + j * CheckboxSize.height + distanceBetween,
                                    CheckboxSize.width,
                                    CheckboxSize.height)];
        j++;
    }

打电话后

    sele = [[SelectionViewController alloc]init];
    [[sele view] setFrame:CGRectMake(0, 0, 400, 300)];

再也没有按钮......

0 个答案:

没有答案