Basically, in Android I have a LinearLayout of 3 views on top of each other. If I set view 1 to 'View.GONE', view 2 becomes the top view and view 3 is still underneath it. Or if I set View 2 to 'View.GONE', View 1 is now above View 3. I cannot find any answers on how to do this in Xcode for an iOS app. I know there is UIStackView but that is iOS 9+ only, which I don't want. How do I do this? In Swift preferably.
            Asked
            
        
        
            Active
            
        
            Viewed 2,238 times
        
    -2
            
            
        - 
                    There is autolayout. Did you look into it ? – Teja Nandamuri Jan 07 '16 at 14:54
- 
                    How do I use AutoLayout to programmatically hide (removing space) and show (taking up space) views in a stack of views, for iOS 8, as asked in the question? – Questioner Jan 07 '16 at 14:56
- 
                    Setup the views as you need, and you need to make the view width/height constraints to 0, and the other views will adjust accordingly. – Teja Nandamuri Jan 07 '16 at 14:56
- 
                    @Mr.T my views are constrained to where they are. If I set their height to 0, they still take up space. – Questioner Jan 07 '16 at 14:58
- 
                    No they dont. Waht kind of constraints did u apply ? Pls add the related information to your question. – Teja Nandamuri Jan 07 '16 at 14:59
1 Answers
1
            I solved the problem by pinning the views to the other views and then instead of trying to change the height of the view using an outlet of the view I created an outlet of the height constraint and set it to 0, as shown in this answer:
 
    
    
        Community
        
- 1
- 1
 
    
    
        Questioner
        
- 2,451
- 4
- 29
- 50