I’m a real noob to objective C but I CANNOT figure out how to push transition from one view to another on a button click.
What I’m doing wrong here? I’ve #imported my Page2.h file in the header
I get these two errors
1 “unexpected interface name ‘Page2’: expected expression”
2 “No known Class method for selector ‘setFrame’
- (IBAction)Page2Switcher:(id)sender {
CGRect inFrame = [_Page1 frame];
CGRect outFrame = Page2;
outFrame.origin.x -= inFrame.size.width;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[Page2 setFrame:inFrame];
[_Page1 setFrame:outFrame];
[UIView commitAnimations];
}
Here is a glaring inconsistency:
From the line:
CGRect outFrame = Page2;you must have thatPage2is of typeCGRect, but this probably is not the case. Figure out what typePage2is and how to get aCGRectfrom it. Most likely,Page2is aUIViewand you want to call[Page2 frame]instead.From the line:
[Page2 setFrame:inFrame];, you must have thatPage2is some object that has aframeproperty, e.g. a subclass ofUIView. This is inconsistent with 1 above wherePage2is of typeCGRect.