Okay so I created a UIButton on a UIScrollView and the I made the button have an image. My app is universal and the button is the same size for every device. I want it to change size based on the device size like it would if it was a SpriteNode with 3x, 2x, and 1x images. How can I do this?
let button = UIButton(type: .Custom)
let image = UIImage(named:"Buy5Button")
button.frame = CGRectMake(0, 0, (image?.size.width)!, (image?.size.height)!)
button.setImage(image, forState: .Normal)
button.addTarget(self, action: "something", forControlEvents: .TouchUpInside)
scrollView.addSubview(button)
self.view?.addSubview(scrollView)
Aucun commentaire:
Enregistrer un commentaire