0

I'm having a strange issue where I cannot set a button image (or a UIImageView.image) programmatically. I can set the image in the storyboard, but if I try to change it, the app freezes up. Example. I have copied the image into the folder and can use that image to set the button in storyboard.

[self.picButton setImage:[UIImage imageNamed:@"myImage.png"] forState:UIControlStateNormal];
user3344717
  • 161
  • 3
  • 5
  • 1
    Are you sure the `picButton` `IBOutlet` is linked? Are you sure the image name is correct? – rebello95 Feb 11 '15 at 19:05
  • Yes, I can for example change the color of the title text programmatically. This works: [self.picButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal]; I've copied the image name multiple times and even renamed it and brought in other images – user3344717 Feb 11 '15 at 19:11

1 Answers1

2

Make sure to add widget target for the images or other assets you want to use in the widget.

Shiv Raj
  • 21
  • 3