Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!!