1

I am new in iPhone development and Objective-C. I have RootViewController and DetailViewController. I don't wanna go back to table view and select other row to show data. I want to check next data directly from the DetailView. But i dont know how to access that array which is defined in RootViewController. Can anyone please help me with that? Please give some example code because i am very new to Objective-C and iPhone development. Thanx in advance.

1 Answer 1

1

There are a couple ways you might pursue this. You could pass the array to the detail view controller. Alternately, and more my recommendation is that you can have your next button handler send a message back to the root controller, to have it run the detailView showing routine on the next item instead of restoring the rootview.

Assuming you have a situation where the delegate of the detailViewController is the rootViewController, you'd have a method in the root viewController like:

- (void)detailViewControllerDidAskForNext:(detailViewController *)controller {
     [self showNextDetail]; //you'd supply the showNextDetail method
}

And a method in the detailController like this, hooked to your next button.

- (IBAction)next {
    [self.delegate detailViewControllerDidAskForNext:self]; 
}

Sorry if these are too vague.

Sign up to request clarification or add additional context in comments.

1 Comment

[self.delegate detailViewControllerDidAskForNext:self]; error on this line:"Request for member 'delegate' in something not a structure or union". I am sorry i am new beginner so dont know y this error is. Thanx in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.