准备将谷歌地图添加到一个UIView上,再把这个UIView放到CCLayer上
AppDelegate已经添加代码:
//adding google map;<p> </p> CCLayer上调用:</p> <p><pre class="brush:cpp; toolbar: true; auto-links: false;">-(id) init { // always call "super" init // Apple recommends to re-assign "self" with the "super's" return value if( (self=) ) { DirectRoomHomeViewController *view = initWithNibName:@"DirectRoomHomeViewController" bundle:nil]; openGLView] addSubview:view.view]; } return self; }
然后就是DirectRoomHomeViewController.m:
@implementation DirectRoomHomeViewController {GMSMapView *mapView_;}
-
(void)loadView {
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20 zoom:6];mapView_ = ;
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @“Sydney”;
marker.snippet = @“Australia”;
marker.map = mapView_;
}
<p> </p>
</span><p><span style="line-height:1.5;">可运行起来的时候只有黑屏,且控制台不断报错:</span></p>
<p>
<p class="p1"><b>Failed to make complete framebuffer object 8cd6</b></p>
<p class="p1"><b><br />
</b></p>
<p class="p1"><b><span style="font-size:24px;color:#e53333;">怎么回事儿呢??</span></b></p>
</p>
</p>
</p>