I am new to objective-c.

I defined uiimage in ViewController.h file like this to use it as a global variable

@property (strong, nonatomic) UIImage * image_current; 

There are several button action in ViewController.c

this variable become nil after a button action.

- (IBAction)analysisButton_click:(UIButton *)sender { 
image_current = imageView.image;
}

I absolutely set value to 'image_current' and checked through debugging.

- (IBAction)resultButton_click:(UIButton *)sender {    
imageView2.image = image_current;    // Suddenly image_current's value became nil
}

These button actions are in same view controller.

help me.

Thanks.

Related posts

Recent Viewed