[英]Nativescript + Angular2 Apple Maps
我正在嘗試使用Nativescript + NG2創建一個基於Apple Map(MapKit)的應用程序,我不確定如何在模板上包括地圖。 我已經在Nativescript-JS應用程序中嘗試過該插件 ,但在NS + NG2中卻無法使用。
我嘗試如下創建MapViewEl,並且不顯示任何錯誤或地圖。
declare var MKMapView: any;
declare var UIScreen: any;
export class MapViewEl {
private _ios: any;
constructor() {
console.log("MapViewEl");
this._ios = MKMapView.alloc().initWithFrame( UIScreen.mainScreen().bounds );
}
get ios(): any {
return this._ios;
}
}
//in app.component.ts
@Component({
selector:"<my-app></my-app>"
template:"<StackLayout><MapViewEl></MapViewEl></StackLayout>"
})
有關如何解決此問題的任何鏈接或說明。
謝謝
好吧,經過如此多的探索和發現,我發現了它,
我錯過了其中的registerElement部分,
//in app.component.ts
registerElement("MapViewEl", () => require("./mapsnew").MapViewEl);
@Component({
selector:"<my-app></my-app>"
template:"<StackLayout><MapViewEl></MapViewEl></StackLayout>"
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.