swift 系统分享

//初始化一个UIActivity
        let activity = UIActivity()
        
        let address = addresslabel.text ?? ""
        let date = dateLabel.text ?? ""
        let content = contentLabel.text ?? ""
        
        let activityItems = NSMutableArray.init(objects: address, date, content)
        activityItems.addObjects(from: imgArray as! [Any])
    
        let activities = [activity]
        //初始化UIActivityViewController
        let activityController = UIActivityViewController(activityItems: activityItems as! [Any], applicationActivities: activities)
       
        //iphone中为模式跳转
        present(activityController, animated: true, completion: nil)

你可能感兴趣的:(swift 系统分享)