More Related Content
Similar to 3D touch for iOS (20)
3D touch for iOS
- 11. Pressure&Sensi*vity
9.1ではさらにUITouchクラスに下記の要
素などが追加される予定。
+,al/tudeAngle:,CGFloat,{,get,}
+,azimuthAngleInView(_,view:,UIView?),+>,
CGFloat
スタイラスの圧力だけではなく、入力角
度なども取得できるようになりそうで
す。
- 17. Quick&Ac(ons
実装例!(add!dynamic!ac*ons)
func application(application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [NSObject: AnyObject]?) -> Bool {
if let shortcutItems = application.shortcutItems where shortcutItems.isEmpty {
let shortcutPlay = UIMutableApplicationShortcutItem(
type: "MyApp.MenuType001",
localizedTitle: "Play",
localizedSubtitle: "with this title",
icon: UIApplicationShortcutIcon(type: .Play),
userInfo: nil
)
application.shortcutItems = [shortcutPlay]
}
...
}
- 19. Quick&Ac(ons
実装例!(ac%onsがよばれた時)
// in AppDelegate
func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: Bool -> Void) {
guard ShortcutIdentifier(fullType: shortcutItem.type) != nil else { return false }
guard let shortCutType = shortcutItem.type as String? else { return false }
switch (shortCutType) {
case "Menu1":
// Menu1の処理
case "Menu2":
// Menu2の処理
default:
}
}
- 28. Peek$and$Pop
実装例!Ac$onMenuの追加
// DetailViewController
override func previewActionItems() -> [UIPreviewActionItem] {
let actionMail = UIPreviewAction(title: "Send mail",
style: .Default,
handler:{item,viewcon in
// send mail
})
let actionDelete = UIPreviewAction(title: "Delete mail",
style: .Destructive,
handler:{item,viewcon in
// delete mail
})
return [actionMail,actionDelete]
}