小编Din*_*kar的帖子

Swift UIActivityViewController图像共享无法正常工作

我正在UIActivityViewController用来分享图片.WhatsApp最近的更改允许分享后我能够在共享选项中看到WhatsApp.我正在分享图像和消息,我可以看到短信,但我无法共享图像.相同的代码适用于Viber,FB,Twitter等.不确定WhatsApp我缺少什么.

func shareImage() {
    var messageStr:String  = "Check out my awesome photo!"
    var img: UIImage = currentPhoto!

    var shareItems:Array = [img, messageStr]

    let activityViewController:UIActivityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil)
    activityViewController.excludedActivityTypes = [UIActivityTypePrint, UIActivityTypePostToWeibo, UIActivityTypeCopyToPasteboard, UIActivityTypeAddToReadingList, UIActivityTypePostToVimeo]

    self.presentViewController(activityViewController, animated: true, completion: nil)

}
Run Code Online (Sandbox Code Playgroud)

ios swift

12
推荐指数
2
解决办法
2万
查看次数

Chrome扩展套接字io节点js

我需要创建一个chrome扩展,当我们从socket io node js server收到消息时会显示一条通知.

如何在chrome扩展中包含socket io?我无法让这个工作.

Content.js: - 未捕获的ReferenceError:未定义io

var socket = io.connect('http://localhost:1337');
socket.on("hello",function(data){
    console.log(data.text);
    chrome.runtime.sendMessage({msg:"socket",text:data.text},function(response){});
});
Run Code Online (Sandbox Code Playgroud)

清单: - 这不是导入套接字io 无法加载扩展名:无法加载后台脚本' http:// localhost:1337/socket.io/socket.io.js '.

    "background": {
    "scripts": [
        "http://localhost:1337/socket.io/socket.io.js",
        "background.js"
    ]
},
Run Code Online (Sandbox Code Playgroud)

node server.js

var app = require('http').createServer(handler).listen(1337);
var io = require('socket.io').listen(app);

function handler(req,res){
    console.log(req.url);
    res.writeHead(200, {'Content-Type':'text/plain'});
    res.end('Hello Node\n You are really really awesome!');
}

io.sockets.on('connection',function(socket){
    socket.emit('hello',{text:"node!"});
});
Run Code Online (Sandbox Code Playgroud)

google-chrome-extension node.js socket.io

10
推荐指数
1
解决办法
3814
查看次数

在使用UIImagePickerController进行拾取后,如何从PhotoLibrary中删除图像

我需要从中删除图像PhotoLibrary.我UIImagePickerController在我的应用程序中使用它来获取图像.我需要在我的应用程序中使用它后从iOS PhotoLibrary中删除此图像.

我的代码片段

if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.PhotoLibrary)
            {
                var imagePicker = UIImagePickerController()
                imagePicker.delegate = self
                imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary;
                imagePicker.allowsEditing = false
                self.presentViewController(imagePicker, animated: true, completion: nil)
            }


// MARK:- UIImagePickerControllerDelegate
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) {
    pickedImage = image
    saveImageToDisk(pickedImage)
/*
I need the logic to delete this image from PhotoLibrary here.
*/
    self.dismissViewControllerAnimated(true, completion: nil)
    refreshCollectionView()
}
Run Code Online (Sandbox Code Playgroud)

xcode ios swift

9
推荐指数
3
解决办法
6752
查看次数

仅在 iOS 13.1 和 13.2 中弹出视图背后的奇怪阴影

尽管弹出背景颜色很清楚,但弹出视图后面有一个奇怪的阴影,这个问题只发生在 13.1 和 13.2 中,并且在 13 及更低版本中工作正常

我可以在视图层次结构中看到 UIWindow/UITransitionView/_UICutoutShadowView 具有仅在 13.1 中具有阴影图像的图像视图,但图像视图在 13 中具有空图像

controller.modalPresentationStyle = .popover
controller.popoverPresentationController?.permittedArrowDirections = .up
controller.popoverPresentationController?.delegate = controller
controller.popoverPresentationController?.sourceView = sourceView
controller.popoverPresentationController?.popoverBackgroundViewClass = FilterBackgroundView.self
present(controller, animated: false)
Run Code Online (Sandbox Code Playgroud)

奇怪的影子图片

uipopovercontroller ios uipopover swift ios13

7
推荐指数
1
解决办法
817
查看次数