5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UIActivityViewControllerでリマインダーやメモを非表示にする方法

Posted at

アプリでUIActivityViewControllerを使ったシェアボタン作ってて、リマインダーとメモを非表示にしようとしてハマったのでメモ。

UIActivityViewControllerではexcludedActivityTypesに不要なUIActivityTypeを指定してあげればいいんですが、 マニュアル見てもメモとリマインダーのUIActivityTypeがみつからない!

いろいろ調べてみるとどうやら、UIActivityType(rawValue:String)で解決できる模様。

こんな感じ。

let activityController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)

// AirDropとリマインダーとメモいらねーです
activityController.excludedActivityTypes = [
            UIActivityType(rawValue: "com.apple.reminders.RemindersEditorExtension"),
            UIActivityType(rawValue: "com.apple.mobilenotes.SharingExtension"),
            UIActivityType.airDrop,]

なんで用意されてないのかよくわかんないけど、解決できて良かった。

参考
http://stackoverflow.com/questions/31792506/how-to-exclude-notes-and-reminders-apps-from-the-uiactivityviewcontroller/32719521#32719521

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?