Skip to content

hmhmsh/HomeScreenQuickActions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HomeScreenQuickActions

iOS9から実装された3DTouchを使用するためのメソッドです

#Usage

AppDelegate.swift

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    let homeActions = HomeScreenQuickActions.sharedInstance
	
    homeActions.addShortCutItem("type", localizedTitle: "title", localizedSubtitle: "subTitle", icon: UIApplicationShortcutIcon(type: UIApplicationShortcutIconType.xx), userInfo: ["":""])

    UIApplication.sharedApplication().shortcutItems = homeActions.shortCutItems
	
    return true
}

func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {

    // for delegate
    HomeScreenQuickActions.sharedInstance.delegateMethod(application, shortCutItem: shortcutItem)

    // for notification
    HomeScreenQuickActions.sharedInstance.notificationMethod(application, shortCutItem: shortcutItem, notificationName: "notificationName")
}

delegate

xx.swift
    
HomeScreenQuickActions.sharedInstance.delegate = self

func shortCutItemDidSelectAtIndex(shortcutItem: UIApplicationShortcutItem, index: Int) {
}

Notification

xx.swift

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(xx.xx(_:)), name: "noticationName", object: nil)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages