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
jean-marie castellucci
4,954 PointsSwift : hide button in sub sub Views
Hello I m trying to hide a button in a sub sub View when a function is fired. I have multiple views with that hierarchy :
var takePhotoButton : UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton
takePhotoButton.addTarget(self, action:"takePhoto", forControlEvents:UIControlEvents.TouchUpInside)
var savePhotoButton : UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton
let view2:UIView = UIView(frame: CGRectMake(0, 0, 320, 568))
self.view.addSubview(photoMask)
photoMask.addSubview(view2)
view2.addSubview(takePhotoButton)
I want to hide the takePhotoButton when the following func is fired, how could i do that ?
func takePhoto() {
// what to put here to hide the takePhotoButton ?
{
1 Answer
jean-marie castellucci
4,954 PointsOk my button was not as a class property so it wasn't accessible.
Now i just added :
self.takePhotoButton.hidden = true