PDA

View Full Version : Table View Question.




DavidBlack
Aug 28, 2013, 01:09 PM
Hi, I have a app going to making it's a tutor app with videos. When the user selects a table cell I want to load a movie, can anyone point me in the right direction?



robvas
Aug 28, 2013, 01:52 PM
Hi, I have a app going to making it's a tutor app with videos. When the user selects a table cell I want to load a movie, can anyone point me in the right direction?

What have you tried so far?

DavidBlack
Aug 29, 2013, 09:12 AM
What have you tried so far?

I haven't tried anything as yet.

pmau
Aug 29, 2013, 09:15 AM
I haven't tried anything as yet.

Sorry, that made me laugh. You are outlining a complex idea, asking about TableViews and then you say you have not tried anything ???

Wow ...

DavidBlack
Aug 29, 2013, 09:26 AM
Sorry, that made me laugh. You are outlining a complex idea, asking about TableViews and then you say you have not tried anything ???

Wow ...

I know it sounds funny... but I am asking for someone to point me in the right direction.

pmau
Aug 29, 2013, 09:33 AM
You open Xcode, create a new project.
You open the main XIB/Storyboard
You drag a SpliView in the Window
You drag a TableView to the left side od the SplitView.
You drag a Custom View Class to the right.
You connect all outlets to you controller and datasource and so on.

I would never design it that way, but if you need a rapid prototype, this ia basically what you do.

Then you implement your datasource and TableView delegate.
Everytime you select a an item on the left, you insert a Movie View as a subview on the right, removing one that's already there.

What's your actual question?

DavidBlack
Aug 29, 2013, 03:28 PM
You open Xcode, create a new project.
You open the main XIB/Storyboard
You drag a SpliView in the Window
You drag a TableView to the left side od the SplitView.
You drag a Custom View Class to the right.
You connect all outlets to you controller and datasource and so on.

I would never design it that way, but if you need a rapid prototype, this ia basically what you do.

Then you implement your datasource and TableView delegate.
Everytime you select a an item on the left, you insert a Movie View as a subview on the right, removing one that's already there.

What's your actual question?

Thanks for your help but I did the steps you stated above already for a prototype but mine I did not use a SplitView.

Sonnestah
Aug 29, 2013, 10:50 PM
Thanks for your help but I did the steps you stated above already for a prototype but mine I did not use a SplitView.

You asked for someone to help by pointing you to the right direction, he gives you the right direction and then you reply with "I did not use splitview"?

I don't get it.:confused:

multinode
Aug 30, 2013, 12:43 AM
You asked for someone to help by pointing you to the right direction, he gives you the right direction and then you reply with "I did not use splitview"?

I don't get it.:confused:

Why the confusion/putdown? He tried something, but he's looking for another way from us AND maybe he doesn't know how to insert a movieview.

Be cool man.

Sonnestah
Aug 30, 2013, 12:51 AM
Why the confusion/putdown? He tried something, but he's looking for another way from us AND maybe he doesn't know how to insert a movieview.

Be cool man.

Confused because he said he followed the steps provided BUT did not use a splitview. That means he actually did not follow it as 3rd step asks him to use one.

Thats what I dont get

multinode
Aug 30, 2013, 01:06 AM
Confused because he said he followed the steps provided BUT did not use a splitview. That means he actually did not follow it as 3rd step asks him to use one.

Thats what I dont get

I read his comments as that he had already done some preliminary coding on his own without the split view. Note the key word "ALREADY" in his response.

Nevermind ... I don't want us to belabor the point. I'm just opting for tolerance ... all of us at times ask what may seem to be stupid questions.

DavidBlack
Oct 6, 2013, 05:42 AM
This is an example of what I will like.

Blakeasd
Oct 6, 2013, 10:10 AM
This is an example of what I will like.

I think I understand your problem.

To get whatever row is selected you can do this:

id selectedItem = [yourTableView itemAtRow:[yourTableView selectedRow]];


With the data that is returned you could use a switch or if-else statement (really anything of deciding nature) to determine what video to play depending on what is selected.

The videos can be played via a QTMovieView, which you can read more about here (https://developer.apple.com/library/mac/documentation/QuickTime/Reference/QTKitFramework/Classes/QTMovieView_Class/Reference/Reference.html).

Just place a QTMovieView next to your table view -- and voila -- switch the videos out as needed.
Hopefully this can help you out!