Friday 24 January 2014

MAPVIEW IN IOS

Map.h

#import <MapKit/MapKit.h>
@interface Map : UIViewController
{
    
}
-(IBAction)back:(id)sender;
@property (nonatomicretainIBOutlet MKMapView *infomap;

@end


Map.m



@interface Map ()

@end

@implementation Map

@synthesize infomap;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [super viewDidLoad];
    [super viewDidUnload];
    [infomap setMapType:MKMapTypeStandard];
    [infomap setZoomEnabled:YES];
    [infomap setScrollEnabled:YES];
    
    MKCoordinateRegion region = { {0.00.0 }, {0.00.0 } };
    region.center.latitude = 13.069613;
    region.center.longitude = 80.273817;
    region.span.longitudeDelta = 0.01f;
    region.span.latitudeDelta = 0.01f;
    [infomap setRegion:region animated:YES];
    
    MainClass *ann = [[MainClass allocinit];
    ann.title =  @"Selvi's";
    ann.subtitle =  @"Tamil Nadu Legislative Assembly";
    
    ann.coordinate = region.center;
    [infomap addAnnotation:ann];
    
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(IBAction)back:(id)sender
{
    contactus *second = [[contactus allocinitWithNibName:nil bundle:nil];
    second.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self dismissModalViewControllerAnimated:YES];
}
@end

No comments:

Post a Comment