For example, I want the maptype in the Mainviewcontroller to change from satellite to hybrid if the segmentedcontrol in the flipsideviewcontroller changes? What am i doing wrong? Basically, I want the mainviewcontroller to react to the changes made in the flipsideviewcontroller!!!
FlipsideViewController.h
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <MapKit/MKMapView.h>
@protocol FlipsideViewControllerDelegate;
@interface FlipsideViewController : UIViewController {
id <FlipsideViewControllerDelegate> delegate;
IBOutlet UISegmentedControl *mapType_;
}
@property (nonatomic, retain) UISegmentedControl *mapType_;
@end
MainViewController.h
@interface MainViewController : UIViewController <XXXX> {
IBOutlet UISegmentedControl *mapType;
}
@property (nonatomic, retain) UISegmentedControl *mapType;
@end
MainViewController.m
-(void)viewDidLoad {
if(mapType.selectedSegmentIndex==0){
mapView.mapType=MKMapTypeStandard;
}
else if (mapType.selectedSegmentIndex==1){
mapView.mapType=MKMapTypeSatellite;
}
else if (mapType.selectedSegmentIndex==2) {
mapView.mapType = MKMapTypeHybrid;
}
}
Any ideas of how to make this possible? What am i doing wrong? Would really appreciate an answer! Thanks!
How do I implement the delegate method (as phix23 answered)...?