In my first file I want to be able to get reference to my second file and change a property that it has, This is what I have. I made a class method to return the reference but the problem is I get a warning in the method, on top of that when I do the if statement it doesnt seem to run.
First File that needs reference, calls class method to get reference
-(void) updateSplitViewDetail{
id detail = (MapViewController*) [MapViewController returnReference];
NSLog(@"%@", [detail class]); //This post MAPVIEWCONTROLLER
//This fails so I cant access the methods inside.
if ([detail isKindOfClass:[MapViewController class]]) {
MapViewController *mapVC = (MapViewController*) detail;
mapVC.delegate = self;
mapVC.annotations = [self mapAnnotations];
}
}
(void)viewDidLoad
{
[super viewDidLoad];
[self updateSplitViewDetail]; //Error may be here?
}
Second File that I want reference to, returns reference using self.
- (void)viewDidLoad
{
NSLog(@"%@", [self class]);
[super viewDidLoad];
self.mapView.delegate = self;
// Do any additional setup after loading the view.
}
+(MapViewController*) returnReference{
//I also get an incompatible pointer return warning here?
return self;
}