在ViewDidLoad方法里面设置按钮图案

    技术2022-05-19  22

     

     

    - (void)viewDidLoad

    {

    UIImage *buttonImageNormal = [UIImage imageNamed:@"whiteButton.png"];

    UIImage *stretchableButtonImageNormal = [buttonImageNormal 

    stretchableImageWithLeftCapWidth:12

    topCapHeight:0];

    [doSomethingButton setBackgroundImage:stretchableButtonImageNormal

    forState:UIControlStateNormal];

    UIImage *buttonImagePressed = [UIImage imageNamed:@"blueButton.png"];

    UIImage *stretchableButtonImagePressed = [buttonImagePressed

      stretchableImageWithLeftCapWidth:12

      topCapHeight:0];

    [doSomethingButton setBackgroundImage:stretchableButtonImagePressed

    forState:UIControlStateHighlighted];

    }

     

     


    最新回复(0)