How can I create a big, red UIButton with iOS?

后端 未结 6 1285
一整个雨季
一整个雨季 2020-11-29 15:03

Using iOS, how would I go about creating a red \"delete\" button similar to the one used when deleting contacts on the iPhone?

6条回答
  •  情深已故
    2020-11-29 15:20

    I think those ones are better (and they look fine on retina display too) :

    alt text alt text

    .png generated from this very nice .psd file : http://www.teehanlax.com/blog/2010/08/12/iphone-4-gui-psd-retina-display/

    And then use it as a strechable image for the background of your UIButton:

    UIImage* greenButton = [UIImage imageNamed:@"UIButton_green.png"]; 
    UIImage *newImage = [greenButton stretchableImageWithLeftCapWidth:greenButton.size.width/2 topCapHeight:greenButton.size.height/2];
    [callButton setBackgroundImage:newImage forState:UIControlStateNormal];
    

提交回复
热议问题