I'm new - i'm sorry - but I'm experimenting with multiview iphone apps, and wondered whether the below idea was a) possible and b) sensible.
I want to create a method that can remove and add views based on some parameters - the outgoing view, the incoming view and the incoming class.
- (void)switchViews:(Class)inView:(Class)outView:(Class)inClass{
inClass *tempView = [[inClass alloc]
initWithNibName:@"inView" bundle:nil];
tempView.burgerViewController = self;
self.inView = tempView;
[tempView release];
[outView.view removeFromSuperview];
[self.view insertSubview:tempView.view atIndex:0];
}
This would be called by:
[burgerViewController switchViews:viewMainMenu:viewOptions:ViewMainMenu];
Any help is much appreciated - I have a lot to learn.
Mike.
Your code is wrong, in that (it appears that) you've misunderstood how method names work in Objective-C.
For example, as your method currently stands, it is named:
That's probably not what you're looking for.
A better name might be:
Declared, that would look like:
And you would use it like this:
For more on Objective-C method names and interleaved arguments, check out the Objective-C Programming Language Reference.