Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JPfowl

macrumors newbie
Original poster
Sep 29, 2013
11
0
Hi there, I have two programs: one is a basic music player (see music 4 zip) and a table view controller that I just made by following a book (see chapter 9 zip). In that table view I want to take the check list view and put it into the music app so when the user clicks on the tag icon they are able to view a list of tags that they can apply to songs to identify them. I need help with a few aspects.
  1. How can I change the table view so that I can check more than one item on the check view?
  2. How can I edit the table view so that instead of just having preset cells I can add a cell when I am running the app?
  3. How do I integrate the two apps together?
The third step will totally be dependent on how we change the apps based on the first 2 steps but I just want you to know the end goal. Thanks for the help!
 

Attachments

  • Music 4.zip
    2.7 MB · Views: 111
  • Chapter_09.zip
    88.9 KB · Views: 95
1. UITableView has a property allowsMultipleSelection. If you set it to true, the table view allows multiple cells to be selected. From the docs:

Discussion
This property controls whether multiple rows can be selected simultaneously outside of editing mode. When the value of this property is YES, a check mark is placed next to each row that is tapped. Tapping the row again removes the check mark. If you call indexPathsForSelectedRows, you can get the index paths that identify the selected rows.

2. Don't use static table views. Create a table view that has a data source and delegate, and implement the methods tableView:numberOfRowsInSection: and tableView:cellForRowAtIndexPath to look up the number of rows/create and populate a cell with the correct data using a mutable array of data as your model.

Then, when you want to add an item to your table view, insert the item into the array and call the table view's reloadData method. You could also add a "+" button to your interface that would insert a new, empty cell with animation and let the user edit that cell, but that's more work (and based on the level of your questions, is beyond your current abilities.)

As to how to integrate your apps into 1, that's up to you. Either take one of the projects and copy the extra source files from the other project into it, or create a new project and add source files from each project into the new project. There is no stock answer to this question. You will need to do some analysis and design to figure out how to merge the 2, and then do original development to get the combined results that you want. If you get stuck during the integration process then by all means come ask specific questions.



Hi there, I have two programs: one is a basic music player (see music 4 zip) and a table view controller that I just made by following a book (see chapter 9 zip). In that table view I want to take the check list view and put it into the music app so when the user clicks on the tag icon they are able to view a list of tags that they can apply to songs to identify them. I need help with a few aspects.
  1. How can I change the table view so that I can check more than one item on the check view?
  2. How can I edit the table view so that instead of just having preset cells I can add a cell when I am running the app?
  3. How do I integrate the two apps together?
The third step will totally be dependent on how we change the apps based on the first 2 steps but I just want you to know the end goal. Thanks for the help!
 
1. UITableView has a property allowsMultipleSelection. If you set it to true, the table view allows multiple cells to be selected.
Then, when you want to add an item to your table view, insert the item into the array and call the table view's reloadData method. You could also add a "+" button to your interface that would insert a new, empty cell with animation and let the user edit that cell, but that's more work (and based on the level of your questions, is beyond your current abilities.)
What would the line of code look like for allowsmultiple selection? I tried to find an example of it but I couldn't come across one.
Also, can you give me an example of the delegate and source because I don't think I have ever used that.
 
What would the line of code look like for allowsmultiple selection? I tried to find an example of it but I couldn't come across one.
Also, can you give me an example of the delegate and source because I don't think I have ever used that.

I am not going to tell you what the line would look like because you need to progress from copying and pasting code to actually understanding programming concepts and writing a line or two of code for yourself.

Setting a property on a view object is painfully, falling-off-a-log simple. If you can't understand how to do that then you are not ready to use table views at all.

"Giving you an example of a delegate and [data] source" does not make sense. You need to read up on the basics of the language, and work up to how to use the delegate design pattern. It's more complex than "giving you an example" that you can cut and paste.

There is an example of table views built into the Xcode help system. Do a search on "TableView Fundamentals for iOS" in the Xcode help system and open the project that it links to. The first example should get you started. If you can adapt that example to your needs then you're doing well.
 
I am not going to tell you what the line would look like because you need to progress from copying and pasting code to actually understanding programming concepts and writing a line or two of code for yourself.

Setting a property on a view object is painfully, falling-off-a-log simple. If you can't understand how to do that then you are not ready to use table views at all.

"Giving you an example of a delegate and [data] source" does not make sense. You need to read up on the basics of the language, and work up to how to use the delegate design pattern. It's more complex than "giving you an example" that you can cut and paste.

There is an example of table views built into the Xcode help system. Do a search on "TableView Fundamentals for iOS" in the Xcode help system and open the project that it links to. The first example should get you started. If you can adapt that example to your needs then you're doing well.

A student has to start somewhere and giving references is very helpful. People learn differently. Seeing is a very good tool as many people are visual learners. From seeing the code people can learn how it works. Your last response was of no help. If I was able to use the code or if I could find references then I would have done so.
Here's my situation. My professor has no idea about xcode or iOS programming and doesn't teach squat. He has assigned us each different app ideas based on who knows what. I have been searching around but don't have enough grasp of the mechanics to program this. I know c/c++ as well as java but this is a specific flavor of objective-c. I have this project due in two days and I really need help. This is still unanswered as I see it.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.