Bobj-C
Bobj-C

Reputation: 5426

return to the original view in view-based-Application

In my app I show a view by this code

[self.view addSubview:view2];

now i want to call the original view from a button (in view2).

thank you.

Upvotes: 0

Views: 92

Answers (1)

Waqas Raja
Waqas Raja

Reputation: 10870

You can do it by removing the view2. i.e

[view2 removeFromSuperview];

An alternative is to use Navigation Controller or simply present Modal View

// present on top of the current view
[self presentModalViewController:viewController2 animated:YES];

on second view controller's button tap event

// remove and back to previous view
[self dismissModalViewControllerAnimated:YES];

Upvotes: 1

Related Questions