lhawks
lhawks

Reputation: 43

prepareForSegue not send right parameter

I have very strange problem with my app. I'm using AFNetworking framework in my app. I'm loading some feed with images and onclick action open new view with detail description and big image. So I send IdPhoto to the description view, but when IdPhoto is more then 12 prepareForSegue send address in memory instead of IdPhoto value.

-(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) {
        DescrController* streamPhotoScreen = segue.destinationViewController;
        streamPhotoScreen.IdPhoto = sender;
    }
}

part of PhotoView code

-(id)initWithIndex:(int)i andData:(NSDictionary*)data {
    self = [super init];
    if (self !=nil) {
        //initialize
        self.tag = [[data objectForKey:@"IdPhoto"] intValue];

so I couldn't understand why it doesn't send IdPhoto to another View when the value more then 12

Upvotes: 1

Views: 68

Answers (2)

Armand DOHM
Armand DOHM

Reputation: 1131

  1. Did you set your property streamPhotoScreen.IdPhoto as STRONG ? and be sure this is not a IBOutlet.
  2. if 1. is ok, can you put a breakpoint in your prepareForSegue: to check if sender is really what you are waiting for...

Upvotes: 1

Macrosoft-Dev
Macrosoft-Dev

Reputation: 2185

I think you need to upcast/downcast(sender) to be appropriate for streamPhotoScreen.IdPhoto.

Upvotes: 0

Related Questions