0

I have a UIVisualEffectView which will act as a "container" view. Have set autoLayout to the container view. I have another 3 UIViews each having separate frame size and elements, ( view 1 has a Label and image, view 2 has a tableView and a label, view 3 have few more uilabels ).

I want to add each of these uiview's to the container view based on some button action.

Am trying to add the subviews using addSubView at each of the button actions. I have added the sub uiview's in the storyboard under the container view's hierarchy and currently my logic depends on hiding the irrelevant uiview's and showing the subview which is relevant. Though I have tried adding the uiview's using addSubView to the container's view, it does not load the views. Have tried doing the same flow using separate .xib but for no effect.

The container view needs to resize based on the subview's height and also load the subView.

Am I doing something wrong or is there some other way to do these design.

4
  • Edit your question to include any relevant code. Sounds like the position of your subviews is the reason they are not visible. Dec 28, 2015 at 13:25
  • Was able to solve the issue by using separate .xib's for each of the subviews and then loading it in the container view as and when required. Using .xib's works perfect for me as it allows me to adjust and reset the frame and also include other elements if required.
    – Shane D
    Dec 29, 2015 at 9:07
  • You should post an answer explaining how you solved your issue. Dec 31, 2015 at 13:40
  • @DanielStorm I did not post an answer as i took a completely different approach then the question that I asked for. Well, there is a way to do it these way itself but I was not able to implement that. I guess deleting the thread itself should be a better solution because I dont have an answer to these question.
    – Shane D
    Jan 1, 2016 at 9:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.