itwend
itwend

Reputation: 41

How to change container in another VC ? iOS

enter image description here

In ViewController i have two property of containers:

@property (weak, nonatomic) IBOutlet UIView *firstContainerView;
@property (weak, nonatomic) IBOutlet UIView *secondContainerView; 

And i can do everything with them:

self.firstContainerView.alpha = 0;
self.secondContainerView.alpha = 1;

But how i can appear firstContainerView from SecondVC method (click button) ?

Upvotes: 0

Views: 105

Answers (2)

TKingLee
TKingLee

Reputation: 13

First of all you must have a pointer to access the target view controller so you see two vc not have a connection so you should create a global pointer for another vc to access. You can create a singleton to hold these vc or just use a delegate or block.

Upvotes: 1

Hossam Ghareeb
Hossam Ghareeb

Reputation: 7123

Why don't use a delegate to inform ViewController that button is clicked and ViewController will take care of appearing/disappearing the containers views.

Upvotes: 0

Related Questions