[Ios]ios9 3DTouch, Shortcutitem, Peek and pop technology at a glance 3DTouch API changes in the Uitouch classattributes added in iOS9
altitudeAngle
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
estimatedProperties
updatedProperties
estimationUpdateIndex
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
uiforcetouchcapability
UIForceTouchCapabilityUnknown
- Not sure if pressure sensing is supported
UIForceTouchCapabilityUnavailable
- Cannot support pressure sensing
UIForceTouchCapabilityAvailable
- can support pressure sensing
Uitouchtype
UITouchTypeDirect
- Vertical Touch Type
UITouchTypeIndirect
- Non-initial touch type
UITouchTypeStylus
- Level of touch type
uitouchproperties
UITouchPropertyForce
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
Create a new Item icon
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