How do you deal with lots of items and text.

Discussion in 'iOS Programming' started by gabe.jimenez, Apr 3, 2015.

  1. gabe.jimenez macrumors newbie

    Joined:
    Apr 3, 2015
    #1
    I have a question for you. I am new to this and need some advice here, The app I am making is one that has a list of over 150 items in a tableview, when you select an item a new MVC comes up and shows the picture, and has button that leads to another MVC that tells you about the item via modal. Each item describes what it contains, and the benefits, these are lengthy descriptions. So in your opinion should I make a new MVC for each description? Or can I dynamically pass in the description to that MVC, and if so where do I put all of the descriptions at so that I can pass in the information. What should I do? Thanks.
     
  2. bbeagle, Apr 3, 2015
    Last edited by a moderator: Apr 3, 2015

    bbeagle macrumors 68040

    bbeagle

    Joined:
    Oct 19, 2010
    Location:
    Buffalo, NY
    #2
    Create a named seque for this transition.

    Then look at the prepareForSegue function. In this you can send information from one ViewController to another.

    In SWIFT:
    Code:
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        var segueViewController = segue.destinationViewControler as! MySecondViewController
       mySecondViewController.someText = self.someText
    }
    
    'MySecondViewController' is the view controller the segue goes to.
    'someText' would be a variable that exists in both view controllers.

    Then in the viewDidAppear() function, copy the someText to the text field.
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    This is often called a master-detail design or drill down UI.

    Yes, you'll most likely make a new detail view controller for each level you drill down into the description. On iPad you might do it differently for the top level of detail view controllers.
     

Share This Page