dimanche 26 avril 2015

Swift: Adding UIImage?


How do I add an image via Swift with the UIImage command? This is my current code:

var imageView = UIImageView(frame: CGRectMake(100, 100, 150, 150));     
myPic = UIImage(named: "bowling");
imageView.image = myPic;
self.view.addSubview(imageView);

It does not show anything, and this is under viewDidLoad(), which should load by default.

Thanks! :)


Aucun commentaire:

Enregistrer un commentaire