Code cracker
Code cracker

Reputation: 3166

Resize UIViewController instead of removing it from navigation stack

user navigate from VC-A --> VC-B. Then when user wants come back to VC-A , VC-B should resize and stay on top. i tried of resizing the VC-B but doesn't bring VC-A to appear.

Upvotes: 0

Views: 50

Answers (3)

Toine Heuvelmans
Toine Heuvelmans

Reputation: 707

If both ViewController A and B are children of a UINavigationController, then you should consider pulling them out of this structure, because the UINavigationController will play by its own rules; A can be unloaded when it is not visible (e.g. when B is presented on top of it), and navigating back from B to A will pop B from the navigation stack.

Upvotes: 1

DonMag
DonMag

Reputation: 77482

If you are viewing VC-A, want to show VC-B, and then want to "resize" VC-B so it only partially covers VC-A...

You cannot do that within a Navigation Controller.

What you'll want to do is add VC-B as a child UIViewController and add its view as a subview of VC-A's view (covering it completely).

Then, instead of going back to VC-A, you will resize/reposition VC-B's view so it is only partially covering VC-A's view.

Upvotes: 1

R1'
R1'

Reputation: 639

It is not possible with a UIViewController Try to recreate your VC-B as a child view of VC-A and set a height and width constraint of your child view in your VC-A so that you can control the position and visibility of the child view from your VC-A

Upvotes: 1

Related Questions