· let activityItems = "Sharing data" let actviewcon = UIActivityViewController (activityItems: activityItems, applicationActivities: nil) bltadwin.rutViewController (actviewcon, animated: true, completion: nil) The above also works well. But I want to be able to do the following: If user selects Email then the PDF is attached as an attachment. Overview. You should subclass UIActivity only if you want to provide custom services to the user. A service takes data that is passed to it, does something to that data, and returns the results. For example, a social media service might take whatever text, images, or other content is provided to it and post them to the user’s bltadwin.rug: pdf. Overview. You can use this protocol in situations where you want to provide the data from one of your app’s existing objects instead of creating a separate UIActivity Item Provider object. When implementing this protocol, your object becomes the data provider, providing the view controller with access to .
UIActivityViewController NSData with Filename. In one of my upcoming apps I want the user to be able to send a file using the UIActivityViewController. As I create the NSData object during runtime, I passed the data to the activity view like this: NSData *someData = /* */; UIActivityViewController *activityViewController. 自己動手做iOS App:從設計開發到上架App Store pdf epub mobi txt 電子書 下載 -靜流書站. UIKit has one main class for sharing content from our apps, and it has a flexible design that lets other services connect to it. This class, UIActivityViewController, can handle sharing text, URLs, image, and more, and is also able to add our app's own services alongside the others. In this article I'll walk through some complete examples of using UIActivityViewController, partly so you can.
Second, you need to subclass UIActivity and complete quite a few properties and methods. Annoyingly, most of these properties are read-only, which means they must be implemented using override var and shadowed properties – temporary properties that hold our data until the real properties can be read. UIActivity () Default constructor, initializes a new instance of this class. UIActivity (Int Ptr) A constructor used when creating managed representations of unmanaged objects; Called by the runtime. UIActivity (NSObject Flag) Constructor to call on derived classes to skip initialization and merely allocate the object. Sharing is a convenient way for users to send data to each other or between devices. It may even net you some new customers! Fortunately, since iOS 6, Apple has provided the handy, but much-overlooked, UIActivityViewController class, which offers a clean interface for sharing and manipulating data inside your app.
0コメント