I had a look at your project and found the answer.
Your FirstView
object has a variable called secondView
, which is exactly the same name as the object in your main workspace. However, despite having the same name both of these are different objects.
I've done a couple things:
1) instead of using variables in the interface file for your objects, use properties.
2) create a SecondView
property in your FirstView
class
3) set the property of firstView
to the same object in your workspace, secondView
My FirstView.h
looks like:
@interface FirstView : C4CanvasController{
C4Label *goToSecondView;
}
@property (readwrite, strong) C4Window *mainCanvas;
@property (readwrite, strong) C4Image *postedImage;
@property (readwrite, strong) SecondView *secondView;
@end
My postNoti:
looks like:
-(void)postNoti{
C4Log(@"tapped");
[self postNotification:@"changeToSecond"];
[self.secondView receiveNumber:self.postedImage];
}
NOTE I got rid of the [SecondView new];
line.
The following is the part that you were missing
My workspace has the following line:
firstView.secondView = secondView;
Which sets the variable of the first view to have a reference to the secondView
object.
You hadn't done this, and so you were passing the image to an object that had the same name as the view that's visible from your main workspace's canvas.