美文网首页
UIActivityViewController

UIActivityViewController

作者: 四毛哥掉落的鳞片 | 来源:发表于2016-06-28 17:41 被阅读0次

    Sharing things using iOS uses a standard, powerful component that other apps can plug into. As a result, it should be your first port of call when adding sharing to an app. This component is called UIActivityViewController: you tell it what kind of data you want to share, and it figures out how best to share it.

    As we're working with images, UIActivityViewController will automatically gives us functionality to share by iMessage, by email and by Twitter and Facebook, as well as saving the image to the photo library, assigning it to contact, printing it out via AirPrint, and more. It even hooks into AirDrop and the iOS 8 extensions system so that other apps can read the image straight from us.

    Best of all, it takes just a handful of lines of code to make it all work. But before we touch UIActivityViewController, we first need to give users a way to trigger sharing, and the way we're going to use is to add a bar button item.

    相关文章

      网友评论

          本文标题:UIActivityViewController

          本文链接:https://www.haomeiwen.com/subject/bbptjttx.html