IOS9 3DTouch, Shortcutitem, Peek and pop technology at a glance

Source: Internet
Author: User

[Ios]ios9 3DTouch, Shortcutitem, Peek and pop technology at a glance  3DTouch API changes in the Uitouch classattributes added in iOS9


    • When the pen is parallel to the plane, the value is 0

    • When the pen is perpendicular to the plane, the value is PI/2


    • Touch characteristics estimated by the current touch object

    • The return value is Uitouchpropertyies


    • Touch features that the current touch object has updated

    • The return value is Uitouchpropertyies


    • When the touch characteristics of each touch object change, the value will be added separately

    • The return value is NSNumber

methods added in IOS9

- PreciseLocationInView:

    • Coordinates of the current touch object

- PrecisePreviousLocationInView:

    • The front coordinate of the current touch object

- azimuthAngleInview:

    • Azimuth angle along the x-axis forward direction

    • When the positive direction of the x-axis is the same, the value is 0

    • When the view parameter is nil, the default is Keywindow

- azimuthUnitVectorInView:

    • Unit vector in the direction of the current touch object

    • When the view parameter is nil, the default is Keywindow



    • Not sure if pressure sensing is supported
    • Cannot support pressure sensing
    • can support pressure sensing


    • Vertical Touch Type
    • Non-initial touch type
    • Level of touch type


Shortcutitem static mode
    • Open Info.plist File
    • Add item under the corresponding Uiapplicationshortcutitems keyword
Dynamic ModeModify a Shortcutitem of the current application
  //获取第0个shortcutItem    id oldItem = [existingShortcutItems objectAtIndex: 0];    //将旧的shortcutItem改变为可修改类型shortcutItem    id mutableItem = [oldItem mutableCopy];    //修改shortcutItem的显示标题    [mutableItem setLocalizedTitle: @“Click Lewis”];
gets the shortcutitems of the current application
  //获取当前应用程序对象    UIApplication *app = [UIApplication sharedApplication];    //获取一个应用程序对象的shortcutItem列表    id existingShortcutItems = [app shortcutItems];
Resets the shortcutitems of the current application
  //根据旧的shortcutItems生成可变shortcutItems数组    id updatedShortcutItems = [existingShortcutItems mutableCopy];    //修改可变shortcutItems数组中对应index下的元素为新的shortcutItem    [updatedShortcutItems replaceObjectAtIndex: 0 withObject: mutableItem];    //修改应用程序对象的shortcutItems为新的数组    [app setShortcutItems: updatedShortcutItems];
Create a new Uiapplicationshortcutitem
    • initialization function

      • - initWithType:localizedTitle:localizedSubtitle:icon:userInfo:
      • - initWithType:localizedTitle:
    • Property

      • localizedTitle:NSString

      • - localizedSubtitle:NSString

      • - type:NSString

      • - icon:UIApplicationShortcutIcon

      • - userInfo:NSDictionary

      • Only read-only features, if you want to make changes, need to go through the Mutablecopy method to change to
Create a new Item icon
    • initialization function

      • + iconWithType:

      • + iconWithTemplateImageName:

      • + iconWithContact:

When the program starts
    • Determines whether the Uiapplicationlaunchoptionsshortcutitemkey in the Launchoptions dictionary is empty
    • When not empty, the Application:didfinishlaunchwithoptions method returns FALSE, otherwise returns true
    • Handling Click events within the Application:performActionForShortcutItem:completionHandler method
Peek and Pop registering the preview feature's proxy object and source viewproxy objects need to accept the Uiviewcontrollerpreviewingdelegate protocol
  @interface RootVC<UIViewControllerPreviewingDelegate>    {}    @end
Peek and Pop methods within a proxy object implementation protocol
@implementationROOTVC-(Uiviewcontroller *) Previewingcontext: (id<uiviewcontrollerpreviewing>) Context Viewcontrollerforlocation: (Cgpoint) Point {Uiviewcontroller *CHILDVC = [[Uiviewcontroller alloc] init]; Childvc. preferredcontentsize =Cgsizemake (0.0f,300F);CGRect rect =cgrectmake (10, Point.y-10, self.view.frame.size.width-20,20);        context.sourcerect = rect;        return CHILDVC;    }    -(void) Previewcontext: (id<< Span class= "hljs-built_in" >uiviewcontrollerpreviewing>) context Commitviewcontroller: ( uiviewcontroller*) VC    {       [ self showviewcontroller:vc sender:self];    }     @end          
Registration method declaration within the Uiviewcontroller class
[self registerForPreviewingWithDelegate:self sourceView:self.view];

IOS9 3DTouch, Shortcutitem, Peek and pop technology at a glance

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.