Basic knowledge of IOS development-fragment 32 and basic knowledge of ios-32

Source: Internet
Author: User
Tags notification center

Basic knowledge of IOS development-fragment 32 and basic knowledge of ios-32

1: Description of animation properties UIViewAnimationOptions

A: Set general animation attributes (you can select multiple attributes at the same time)

UIViewAnimationOptionLayoutSubviews: ensure that the child view follows the motion during the animation process.

UIViewAnimationOptionAllowUserInteraction: Allows user interaction during the animation process.

UIViewAnimationOptionBeginFromCurrentState: all views run from the current state.

UIViewAnimationOptionRepeat: re-run the animation.

UIViewAnimationOptionAutoreverse: After the animation is run to the end point, it is still returned to the initial point as an animation.

UIViewAnimationOptionOverrideInheritedDuration: Ignore nested animation time settings.

UIViewAnimationOptionOverrideInheritedCurve: Ignore nested animation speed settings.

UIViewAnimationOptionAllowAnimatedContent: redraws the view during the animation process (note that it is only applicable to transition animation ).

UIViewAnimationOptionShowHideTransitionViews: the old view and new view are directly hidden when the view is switched, instead of removing the old view from the parent view (only applicable to transition animation)
UIViewAnimationOptionOverrideInheritedOptions: does not inherit the parent animation setting or animation type.

B. animation Speed Control (you can select a setting from it)

UIViewAnimationOptionCurveEaseInOut: the animation is slow and then accelerated.

UIViewAnimationOptionCurveEaseIn: the animation slows down.

UIViewAnimationOptionCurveEaseOut: the animation is accelerating.

UIViewAnimationOptionCurveLinear: the animation is executed at a constant speed. The default value is.

C. Transfer Type (only applicable to transfer animation settings. You can select one of them for setting. Basic animation and Key Frame Animation do not need to be set)

UIViewAnimationOptionTransitionNone: no transition animation effect.

UIViewAnimationOptionTransitionFlipFromLeft: flipped from the left.

UIViewAnimationOptionTransitionFlipFromRight: flipped from the right side.

UIViewAnimationOptionTransitionCurlUp: The Animated transition effect for backward paging.

UIViewAnimationOptionTransitionCurlDown: transition effect of the animation to the previous page flip.

UIViewAnimationOptionTransitionCrossDissolve: the old view disappears and shows the effect of the next new view.

UIViewAnimationOptionTransitionFlipFromTop: flipped from the top.

UIViewAnimationOptionTransitionFlipFromBottom: The result is flipped from the bottom.

 

2: complex UITableCellView, removing Reuse

-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) indexPath {_ weak typeof (self) weakSelf = self; BLSPayOrderModel * model = self. dataList [indexPath. section]; BLSProjectMoneyCompleteCell * cell = [tableView sequence: NSStringFromClass ([sequence class])]; if (cell) {cell = [[BLSProjectMoneyCompleteCell alloc] initWithSty Le: UITableViewCellStyleDefault reuseIdentifier: NSStringFromClass ([BLSProjectMoneyCompleteCell class])];} else {// delete all child views of a cell while ([cell. contentView. subviews lastObject]! = Nil) {[(UIView *) [cell. contentView. subviews lastObject] removeFromSuperview] ;}} cell. myPayOrderModel = model; return cell ;}

 

3: Use local notifications

Enter the information to be sent, and pass the label value through the button method call.-(IBAction) buttonClick :( id) sender {// Add a dictionary, pass NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: self. textFieldOne. text, @ "textOne", self. textFieldTwo. text, @ "textTwo", nil]; // create a notification NSNotification * notification = [NSNotification notificationWithName: @ "tongzhi" object: nil userInfo: dict]; // send a notification through the notification center [[NSNotificationCenter defacenter Center] PostNotification: notification]; [self. navigationController popViewControllerAnimated: YES];} after a notification is sent, register the notification listener in the Controller to be received and receive the notification message-(void) viewDidLoad {[super viewDidLoad]; // register the notification [[NSNotificationCenter defacenter center] addObserver: self selector: @ selector (tongzhi :) name: @ "tongzhi" object: nil];}-(void) tongzhi :( NSNotification *) text {NSLog (@ "% @", text. userInfo [@ "textOne"]); NSLog (@ "----- received notification ------");} Removal notification: removeObserver: And removeObserver: name: object: Where removeObserver: is to delete all the entries of an observer in the scheduling table saved by the notification center, while removeObserver: name: object: is to delete an entry that matches the observer in the scheduling table saved by the notification center. This is relatively simple, just call this method. For example, [[nsicationicationcenter defacenter center] removeObserver: observer name: nil object: self]. Note that the parameter icationicationobserver is the observer to be deleted and cannot be set to nil.

 

4: URL Scheme knowledge points in iOS

The iOS SDK provides a very interesting feature that can bind iOS applications to a custom URL Schema, you can also use URL Scheme to start this Application in a browser or other applications. This document describes how to use URL Scheme to start an application and transfer parameters.

1. First, add a line in *-Info. plist and select URL types. The effect is shown in:

2. Enter the URL identifier in the expanded Item 0, which uniquely identifies the User-Defined URL Scheme. We recommend that you use the Reverse Domain Name format, such as com. devzeng. demo.

3: Add a new row in Item 0 and select URL Schemes

4. Expand the URL Schemes and enter the name of the custom Scheme in Item 0. Here, you only need to enter the name of the custom Scheme without adding: //. For example, if devzeng is entered here, the corresponding custom URL is devzeng ://, you can enter multiple entries here.

5. The last complete example:

Use URL Scheme

Tip 1. in Safari, use the intent generator to directly enter devzeng: // in the address bar of the browser in Safari to start the app just now.

2. In other applications, use the following code to call zookeeper:

NSString *customURL = @"devzeng://";[[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];

3. Passing Parameters

- (void)openOtherApp{    NSString *customURL = @"devzeng://?token=123abct®istered=1";    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];}

You can implement the following two methods in AppDelegate:

-(BOOL) application :( UIApplication *) application handleOpenURL :( NSURL *) url too many

-(BOOL) application :( UIApplication *) application openURL :( NSURL *) url sourceApplication :( NSString *) sourceApplication annotation :( id) annotation without modification

Note: Renewal:

Except (1) the two functions above are consistent, but the parameters are different. The return value of the function is BOOL. If YES, the function can be opened, and NO indicates that the application cannot be opened.

The dimensions (2) parameter can be obtained through [url query]. For example, devzeng ://? Token = 123 abct & registered = 1 then the value obtained through [url query] is token = 123 abct & registered = 1, and then the data can be processed accordingly.

Bundle ID of the application called by callback (3) can be obtained through the sourceApplication Parameter

(4) The request url scheme can be obtained through [URL Scheme]. For example, if the request is opened through devzeng: //, the value of [url scheme] Is devzeng. Different parameters can be used to determine the legality of the source.

Example of round (5)

-(BOOL) application :( UIApplication *) application openURL :( NSURL *) url sourceApplication :( NSString *) sourceApplication annotation :( id) annotation {if ([sourceApplication isEqualToString: @ "com. devzeng. demo. urlscheme "]) {NSLog (@" Bundle ID of the called application is: % @ ", sourceApplication); NSLog (@" URL scheme: % @", [url scheme]); NSLog (@ "URL query: % @", [url query]); return YES ;}else {return NO ;}}

* Note that you can create multiple scheme files. In addition to creating a plist file, you can also create Info -- URL Types in Targets.

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: info-contact@alibabacloud.com 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.