Table View Integration

Discussion in 'iOS Programming' started by JPfowl, Nov 20, 2013.

  1. JPfowl macrumors newbie

    Joined:
    Sep 29, 2013
    #1
    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!
     

    Attached Files:

  2. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #2
    1. UITableView has a property allowsMultipleSelection. If you set it to true, the table view allows multiple cells to be selected. From the docs:

    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.



     
  3. JPfowl thread starter macrumors newbie

    Joined:
    Sep 29, 2013
    #3
    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.
     
  4. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #4
    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.
     
  5. JPfowl, Dec 17, 2013
    Last edited: Dec 17, 2013

    JPfowl thread starter macrumors newbie

    Joined:
    Sep 29, 2013
    #5
    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.
     

Share This Page