首页 > 代码库 > UIPickerView更改大小

UIPickerView更改大小

1、网上找的

这个是MRC代码:

    UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];

        CGRect pickerRect = CGRectMake(680, 60, 100, 650);

        pickerView.frame = pickerRect;

   CGFloat color[4] = {1,1,0,1};

        CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();

        CGColorRef layerBounderColor = CGColorCreate(rgb, color);

        CGColorSpaceRelease(rgb);

        CALayer *viewLayer = pickerView.layer;

        [viewLayer setBounds:CGRectMake(580, -50, 80, 700)];

        [viewLayer setBackgroundColor:layerBounderColor];

        [viewLayer setContentsRect:CGRectMake(0, 0, 100, 150)];

        [viewLayer setBorderWidth:20];

        [viewLayer setBorderColor:layerBounderColor];

        CGColorRelease(layerBounderColor);

2、其实就是改Layer

    CALayer *viewLayer = pickerView.layer;

        [viewLayer setFrame:CGRectMake(580, -50, 80, 700)];

        [viewLayer setBorderWidth:0];

 

UIPickerView更改大小