3DTouch
Changes to the API in the Uitouch class properties 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
- Coordinates of the current touch object
- Precisepreviouslocationinview:
- The front coordinate of the current touch object
-
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
-
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
Uitouchtypeindirect
Uitouchtypestylus
Uitouchproperties
Uitouchpropertyforce
Shortcutitem
static mode
- Open Info.plist File
- Add item under the corresponding Uiapplicationshortcutitems keyword
Dynamically modifies 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
Nsmutableapplicationshortcutitem
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
Proxy objects and Source view proxy objects that register the preview feature 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<uiviewcontrollerpreviewing >) Context Commitviewcontroller: (uiviewcontroller*) VC {[ self showviewcontroller:vc sender:self];} @end
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
Registration method declaration within the Uiviewcontroller class
[self registerForPreviewingWithDelegate:self sourceView:self.view];
Reprint Address: http://www.jianshu.com/p/74fe6cbc542b
IOS 3D Touch