How to use mark annotation in Xcode

Source: Internet
Author: User

When we write many methods in a class of Xcode, it is often difficult to distinguish between the methods of some functions, and sometimes it is difficult to find some similar functions. This is the time to use Mark notation, a tagging tool that can quickly find the same kind of method.

The format is:

#pragma mark-... Here, write what you want to mark;

The sample code is as follows:

#import "SecondViewController.h"

@interface secondviewcontroller ()

@end

@implementation Secondviewcontroller


#pragma mark-Start loading page
-(void) viewdidload {
  [super viewdidload];
  Do no additional setup after loading the view.
}


#pragma mark-Initialization method

-(void) method1{
  
  
}

#pragma mark-the method that responds to user action
-(void) method2{
  
  
}

-( void) method3{
  
  
}-(void)

method4{
  
  
}

-(void) method5{
  
  
}

#pragma mark-Network request implementation
-( void) method6{
  
  
}

-(void) method7{
  
  
}




@end

As the code shows, it's handy to have a mark mark in front of some methods that are functionally similar, and then find some way through the navigation bar:



This makes it easy for others to read the code. We can also remove the "-" small horizontal line behind mark so that there is no split.



GitHub home: https://github.com/chenyufeng1991. You are welcome to visit.

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.