简体   繁体   English

采取截图离子框架

[英]Taking Screenshot Ionic framework

I'm building Ionic application that have geolocation (Google Api), but that's irelevant, in upper right corner is button which i want to make to take screenshot and automatically make popover with options to send that screenshot image via email, viber..., but i don't have an idea how to take that screenshot, I googled and googled without any luck, please help. 我正在构建具有地理位置(Google Api)的Ionic应用程序,但这是相关的,在右上角是我想制作截图的按钮,并自动制作popover选项,通过电子邮件,viber发送截图图像... ,但我不知道如何拍摄截图,我用Google搜索并搜索没有任何运气,请帮忙。

app.controller('MapCtrl', function($scope, $cordovaGeolocation, $ionicLoading, $ionicPlatform) {

    $ionicPlatform.ready(function() {

        $ionicLoading.show({
            template: '<ion-spinner icon="bubbles"></ion-spinner><br/>Acquiring location!'
        });

        var posOptions = {
            enableHighAccuracy: true,
            timeout: 20000,
            maximumAge: 0
        };
        $cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
            var lat  = position.coords.latitude;
            var long = position.coords.longitude;

            var myLatlng = new google.maps.LatLng(lat, long);

            var mapOptions = {
                center: myLatlng,
                zoom: 16,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };          

            var map = new google.maps.Map(document.getElementById("map"), mapOptions);          

            $scope.map = map;   
            $ionicLoading.hide();   

            var marker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            title: 'Lokacija'
        });


        }, function(err) {
            $ionicLoading.hide();
            console.log(err);
        });
    });               
});

预习

Two options, as far as I can tell: 据我所知,有两种选择:

This should get you started: How to take a screen shot in ionic 这应该让你开始: 如何拍摄离子屏幕截图

After you received the picture from the plugin, you can just use ionic's popover service to display it there. 从插件中收到图片后,您可以使用ionic的popover服务在那里显示它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM