Requesting assistance with Application Development
First let me apologize for having to bother you with this request for assistance. I am normally resilient enough to figure things out for myself, but I am stuck, partially due to me being new to iPhone development (and the Mac).
Here is the problem;
I am creating an application that has a NavController, a TableView, a SearchBar, NS Dictionary, NS MutableDictionary and NS Mutable Array. The current flow of the app, includes loading of the app, list being populated, the list being searchable and segmented. I have no problems searching or selecting a row and "navigating" to a new view (xib). Here in the lies the problem.
In the new xib I wish to display a picture, text and a play button for some animation (.mov) file. I have the content of this xib file built, the image displays (using UIIMageView - but is static the image is defined in IB), a text field displayed using a UITextView (that is populated with a textView.text = statement in the viewDidLoad controller of the new xib) and a IBaction and associated button to play the video, with a video identified.
The problem, how do I associate the didSelectRowatIndexPath contained in the "table"-viewController with the content that is displayed in the new xib file ("content" - viewController).- e.g. I select row (3,4) and an associated image, text and video is displayed in the xib (view).
If you are kind of enough to respond, please keep in mind that I am newbie to programming and phrase your responses accordingly. If there is a thread that already addresses this topic please inform let me know the location.
I am new to using posts when requesting help. What is the trick to getting some assistance/response? Did I not word my request appropriately or include enough information. Do I need to add a "bribe" of a six pack of your favorite beer if you assist me in solving the problem .
I don't use IB at all, so I can't help you with that aspect of it. However in general, you would likely have your array storing custom NSObjects that represent the encapsulated data for a single item in your table ( like image, movie, etc ).
Just like you use that to display the information in the cell, you'd also reference that in the didSelectRowAtIndexPath and then assign it to the new view by setting properties in the newly created view that is pushed onto the stack ( or through a convenience method that will let you just pass the object and it sets all the stuff it needs to ).
Thanks for the quick response. I will try and decipher the info you sent. I think I have an idea with what you are saying in relation to the code. I hate being in a newbie status ...."life is so much easier when you don't challenge yourself, but then it wouldn't be much of a life".
The "SimpleDrillDown" sample app demonstrates creating and using a "DataController" class to pass an object (in this case, a Dictionary) to your content view.
I'm working on a similar problem. My object contains a name, a description, and an image. I would like to load an image into a UIImageView based on what was selected in the table row from the previous view. How do I load that? I can get everything to display, but the image. The name of the row appears in the nav bar, the description appears in the UILabel, but the image does not appear in the UIImageView.
The array entries look like this:
Fruit *fruit1 = [[Fruit alloc] initWithName:@"banana" description:@"This is a banana" picture:@"banana.png"];
My view is populated like this:
[self.navigationController pushViewController:self.fruitView animated:YES];
//put fruit name in the nav bar
self.fruitView.title = [fruit name];
//put fruit description into the label on the view
[self.fruitView.fruitDescription setText:[fruit description]];
I tried all these and nothing works:
//put the image into the UIImageView
[self.fruitView setImage:[fruit picture]];
self.fruitView.picture = [fruit picture];
[self.fruitView.picture setImage:[fruit picture]];
self.fruitView.image = [fruit picture];