I am new to iPhone development, i have used view based application in which i have use navigation controller, after clicking row in custom table view, it shows a navigation controller with back button titled with the default title of previous screen.
But in detail view i have created a custom back button and after clicking on that button i want to go back to the previous screen.
code to call custom button is:
[backBtn addTarget:self action:@selector(btnClicked) forControlEvents:UIControlEventTouchUpInside];
and the code inside of btnClicked is:
[self dismissModalViewControllerAnimated:YES];
but i am not going to the previous screen.
If you have used a
navigationControlleri guess you might have pushed the view onto the stack usingpushViewController: animated:method. or perhaps evenpresentModalViewcontroller: animated:If its the first case then in your custom back button method you should do
If its the second case then it should do
dismissModalViewControllerAnimated:but remember to dismiss from the object used to present it.