Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Kieran Robinson
Kieran Robinson
9,411 Points

Hiding storyboard created views programmatically

I have a property "imageBar". It is a View that contains 6 imageViews, I want to animate the view to be hidden if there are no images in the imageViews. However, the line to simply hide the imageBar doesn't work, i am using

self.imageBar.hidden = YES;

within ViewDidLoad, but the imageBar is not hidden. ImageView was created in storyboard and i was wondering if it is even possible to edit storyboard created views programatically?

Kieran Robinson
Kieran Robinson
9,411 Points

Yes Ash, I hadn't connected it as an outlet using the assistant editor, I realised this as soon as i clicked 'post'!

2 Answers

Thomas Nilsen
Thomas Nilsen
14,957 Points

First, check that your "imageBar" outlet is properly connected. Second, I'd try and put the code where you set .hidden = YES in

- (void)viewWillAppear{}
Kieran Robinson
Kieran Robinson
9,411 Points

Thank you Thomas Nilsen , i realised what I'd done soon after i posted this, thank you for taking the time to help! i hadn't connected the view properly!!