Search code examples
objective-cioscocoa-touchuistepper

Changing the size of UIStepper


I can't seem to change the size of UIStepper:

  1. In IB, the Width and Height boxes are grayed out.
  2. I used initWithFrame:

    UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(300, 638, 120, 80)];

    But it does not change the size. Several posts on SO seemed to implied it is changeable. Any suggestion?


Solution

  • from the doc:

    The bounding rectangle for a stepper matches that of a UISwitch object.

    Doesn't sound, like it is possible upfront.

    Also in this blog post:

    // Frame defines location, size values are ignored
    UIStepper *stepper = [[UIStepper alloc] initWithFrame:CGRectMake(120, 20, 0, 0)]; 
    

    But you can try to transform it's layer.