ios - Google Maps SDK not displaying properly in UIView? -
i'm having problems displaying google maps in xcode 6.1
i managed map display in section of uiview, displays world map instead of @ particular coordinate.
here issue:
.h:
@interface mapviewcontroller : uiviewcontroller @property (strong, nonatomic) iboutlet uiview *googlemapview; - (ibaction)maptomain:(uibutton *)sender; @end
.m:
- (void)viewdidload { [super viewdidload]; // additional setup after loading view. gmscameraposition *camera = [gmscameraposition camerawithlatitude: 32.915134 longitude: -117.140269 zoom: 17]; gmsmapview *mapview = [gmsmapview mapwithframe:self.googlemapview.bounds camera:camera]; mapview.mylocationenabled = yes; self.googlemapview = mapview; gmsmarker *marker = [ [gmsmarker alloc] init]; marker.position = cllocationcoordinate2dmake(32.915134, -117.140269); marker.title = @"tet festival 2015"; marker.snippet = @"vaya tet"; marker.map = mapview; }
i saw suggestions here, didn't work:
cannot set google maps gmsmapview in subview of main main view?
using google maps sdk in views other main view
any suggestions?
you have add together uiview storyboard... after have turn simple uiview gmsmapview! select view added , open identity inspector selecting 3rd tab left in utilities toolbar, alter view’s class name uiview gmsmapview, shown in screenshot below:
your outlet not this
@property (strong, nonatomic) iboutlet uiview *googlemapview;
it this
@property (strong, nonatomic) iboutlet gmsmapview *mapview;
your viewdidload can this:
gmscameraposition *camera = [gmscameraposition camerawithlatitude: 32.915134 longitude: -117.140269 zoom: 17]; [self.mapview animatetocameraposition:camera]; gmsmarker *marker = [ [gmsmarker alloc] init]; marker.position = cllocationcoordinate2dmake(32.915134, -117.140269); marker.title = @"tet festival 2015"; marker.snippet = @"vaya tet"; marker.map = self.mapview;
update
here have illustration project (insert key)
ios objective-c xcode xcode6
No comments:
Post a Comment