我在 Android (Titanium) 中第二次使用地图视图时出现错误

发布于 2024-09-10 04:04:18 字数 1178 浏览 0 评论 0原文

我的表列表上的记录包含具有纬度和纬度的数据。列表寡妇上的经度。当我单击每一行时,它会传递到显示地图视图及其该记录的注释的详细信息窗口。

我放大并出去,移动到不同的区域,我单击“后退”按钮返回到记录列表。

然后,我选择不同的记录以再次在详细信息窗口上查看地图,当我在详细信息窗口上突然单击地图时,它向我发出一条错误消息,其中没有提及具体问题。

这是我的代码:

        self.listingAnnotation = Titanium.Map.createAnnotation({
            pincolor: Titanium.Map.ANNOTATION_RED,
            latitude: latitude,
            longitude: longitude,
            animate: true
        });

        self.region = {
                latitude: latitude,
                longitude: longitude
        };

        if(!self._mapview){
            self._mapview = Titanium.Map.createView({
                top: 130,
                bottom: 0,
                animate:true,
                mapType: Titanium.Map.STANDARD_TYPE,
                region: {latitude: latitude, longitude: longitude},
                annotations: [self.listingAnnotation]
            }); 
        }
        else{
            self._mapview.removeAllAnnotations();
            self._mapview.setLocation(self.region);
            self._mapview.addAnnotation(self.listingAnnotation);
        }

        self._listingDetailWindow.add(self._mapview);

I have records on the table list contains data that has latitude & longitude on the listing widow. When I click on each row, it passes to the detail window that display the mapview and its annotation of that record.

I zoom in & out, moved to different area and I clicked "back" button to go back to the record list.

Then, I selected on the different record to see the map on the detail window again, when I'm on the detail window suddenly I clicked on the map, there, it alerts me an error message which did not mention about the specific issues.

Here is my code:

        self.listingAnnotation = Titanium.Map.createAnnotation({
            pincolor: Titanium.Map.ANNOTATION_RED,
            latitude: latitude,
            longitude: longitude,
            animate: true
        });

        self.region = {
                latitude: latitude,
                longitude: longitude
        };

        if(!self._mapview){
            self._mapview = Titanium.Map.createView({
                top: 130,
                bottom: 0,
                animate:true,
                mapType: Titanium.Map.STANDARD_TYPE,
                region: {latitude: latitude, longitude: longitude},
                annotations: [self.listingAnnotation]
            }); 
        }
        else{
            self._mapview.removeAllAnnotations();
            self._mapview.setLocation(self.region);
            self._mapview.addAnnotation(self.listingAnnotation);
        }

        self._listingDetailWindow.add(self._mapview);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文