SplitView madness

Discussion in 'iOS Programming' started by jrlane, May 28, 2010.

  1. jrlane macrumors newbie

    Joined:
    May 28, 2010
    #1
    After an exhaustive search last night and this morning I surrender.

    I'm developing a simple quiz application for the iPad based on the splitview template. Everything is coded except for one last thing, instead of forcing the user to select the next question from the menu or popover menu i would like to include a "next" button. As simple as that sounds i have been unable to find a way to do this. Can anyone help?

    On a side note: it would also be nice to be able to automatically select the first row "question in my case" upon load. This shouldn't be an issue if i can solve problem one.

    Many thanks to all who read this.

    Joe.:apple:
     
  2. TiberiusXavier macrumors member

    Joined:
    Apr 18, 2010
    Location:
    Chicago
    #2
    Are you able to define a delegate so that the 'next' button will invoke a callback to the primary view controller?
     
  3. jrlane thread starter macrumors newbie

    Joined:
    May 28, 2010
    #3
    To be honest I don't know. If you meant it like is it possible i don't know, or can i make that change, yes i can do whatever.
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    Buttons work by sending a message when they are tapped. In the method that is invoked by this message your code can of course do what it likes. So you might have a method called next, and you set your button to send a message to the next selector. In that method you would push a new view controller or update the current view controller or whatever is appropriate for the next message.

    Your button might live in a toolbar or a navbar or in a view.
     
  5. jrlane thread starter macrumors newbie

    Joined:
    May 28, 2010
    #5
    This much i know. I have a method that is called when next is pressed. Currently i can use my setDetailItem method inside my DetailViewController to update my view but thats not enough, somehow i also need to change the highlighted table row of my RootViewController, but i do not have access to or don't know what method changes that. How can i send a message to a Different class that i don't have access to the objects that the method needs: heres the method.
    Code:
    - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
     
  6. skunkworker macrumors regular

    Joined:
    Sep 9, 2007
    #6
    What do you mean you don't have access to it? You have the data source.
    Are you talking about manually setting which row is highlighted?
    It would be helpful if you posted more code on this subject.
     
  7. KoolStar macrumors demi-god

    KoolStar

    Joined:
    Oct 16, 2006
    Location:
    Kentucky
    #7
    One option is to create a class method that you can call that will increment the selected index.
     
  8. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #8
    I had to solve this recently. What I did was to capture a pointer to the split/popover tableview and all the indexpaths into its table while it was being loaded by calls to cellForRowAtIndexPath .

    Then I could call: selectRowAtIndexPath after pulling the required indexpath out of an array where I had them all saved.

    There a lots of places to stash data, in singleton model objects, in the app delegate, in C global variables, or any combination of the above.
     
  9. jrlane thread starter macrumors newbie

    Joined:
    May 28, 2010
    #9
    Thanks for the ideas guys! What i thought was there would be an elegant way to do this that apple planned for, apparently its all just a hack.:p
     

Share This Page