segue

Discussion in 'iOS Programming' started by Hustle, Jun 26, 2013.

  1. Hustle macrumors 6502a

    Joined:
    Jul 29, 2007
    Location:
    United Kingdom
    #1
    Hey,

    I'm working through a tutorial to mess around with a photo app, however instead of using storyboards, I'm using .xib files.

    As a result of this, I've become stuck and am hoping someone might be able to help out.

    Basically, you select a photo, and it takes you to another view (or in my case another .xib file) showing a larger version of the photo. Because I'm not using storyboards however, I'm unsure how to edit these two methods so that they can be used with an .xib.


    Code:
    -(void)didSelectPhoto:(PhotoView*)sender {
        //photo selected - show it full screen
        [self performSegueWithIdentifier:@"ShowPhoto" sender:[NSNumber numberWithInt:sender.tag]];
    }
    
    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        if ([@"ShowPhoto" compare: segue.identifier]==NSOrderedSame) {
            StreamPhotoScreen* streamPhotoScreen = segue.destinationViewController;
            streamPhotoScreen.IdPhoto = sender;
        }
    }
    Sorry if this is not very technically worded, I'm a newbie at obj-c. :)
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    Why not use storyboards?

    Also, could you provide a link to the tutorial you're following, or if it's not online, could you provide details on the publication you got it from?
     
  3. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #3


    If you're a newbie then you should either use storyboards, or find a tutorial that is based on using XIBs. Trying to make core structural changes to a tutorial isn't a good way to start out.
     
  4. Hustle thread starter macrumors 6502a

    Joined:
    Jul 29, 2007
    Location:
    United Kingdom
    #4
    Maybe it's time I started to. I've used .xib's since I started to learn obj-c last year, and have avoided storyboards. Maybe my next tutorial should be on storyboarding. :p

    I originally followed this tutorial on how to create a photo app which I completed fine, however I've been rebuilding it and adding my own touches without using storyboards.

    I mainly wanted to find out about grabbing and sending data to a mySQL database which was why I used that tutorial.

    ----------

    I agree it's not a good way to start out, but I scrolled across the tutorial online and thought it would be a fun way to spend the evening, even if it is out of my league.

    I was hoping there would be a simple way to amend the code I posted so it would work, but obviously not.

    I'll switch to storyboarding. :)
     
  5. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #5
    I'm pretty sure it would be pretty easy to switch the code out to use XIBs, it's just been so long I can't think of the correct code off the top of my head (and I'm on my iPhone, which is less than ideal for both researching and posting at the same time.)

    There's no reason to not use Storyboards and I would say the sooner you learn how to use them, the better.
     
  6. Hustle thread starter macrumors 6502a

    Joined:
    Jul 29, 2007
    Location:
    United Kingdom
    #6
    Thanks for the reply.

    I think I'll leave this for now then, pick up some tutorials/books on storyboarding and have a go at that. Hopefully I'll be able to come back to this in the future and know where to go from here.

    :)
     
  7. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #7
    The quick way to do this would be to create a navigation controller and use that to manage the views that you were managing with segues.
     

Share This Page