-2

/* Hello, I am learning Iphone App development. I have a doubt, in case i want to cancel the current page view and go to home page( Its nothing but cancel Button), how can i figure it out? */

// thanks in Advance//

kumar
  • 1
  • 1
  • can you be more elaborative..your question is not clear. – Ajeet Pratap Maurya Nov 16 '11 at 10:21
  • OK,, FOr example we have a Gmail login page in which we have two buttons one is Login Button and one is Cancel Button, were as "cancel" button will cancel the page and take you to home page. if i want to configure that cancel button in Iphone how can i do it? – kumar Nov 16 '11 at 10:40
  • That still isn't a question. What have you developed so far? What is the structure of your app? How are you presenting the "pages"? – jrturton Nov 16 '11 at 13:20

3 Answers3

2

if i understand you correctly, you should use "NavigationController" like this;

[self.navigationController popToRootViewControllerAnimated:YES];
[self.navigationController popToViewController:myviewcontroller animated:YES];
relower
  • 1,293
  • 1
  • 10
  • 20
2

there are 2 ways to cancel view(go to home page) 1-if you are using navigationController than try this => [self.navigationController popToRootViewControllerAnimated:YES];

2-if you are using present model view controller than try this =>

[self dismissModalViewControllerAnimated:YES];

3-if you are presenting the view in sub view of homepage(or like parent-child) than try this => ["your view name" removeFromSuperview];

this is useful for me i think it may help you,

Muhammad Rizwan
  • 3,470
  • 1
  • 27
  • 35
  • if it is like exit button( in the form of UIButton) then? – kumar Nov 16 '11 at 11:02
  • from where you want to exit? first clear this. what are you doing in your app like navigation or present view? – Muhammad Rizwan Nov 16 '11 at 11:08
  • i want to exit out of the app, means i want to close the app and get out of it by pressing a button. – kumar Nov 16 '11 at 11:14
  • first try your own after search for your requirement and after that you are not find anythig than ask question ok? on stack-o-flow itself you can find your answer ok on this link- http://stackoverflow.com/questions/355168/proper-way-to-exit-iphone-application – Muhammad Rizwan Nov 16 '11 at 11:21
0

I think you want to remove your current view. If so Use [yourview removeFromSuperview];

Saranya
  • 1,481
  • 3
  • 14
  • 26