Τετάρτη, 28 Μαρτίου 2012

#pragma mark

Objective-C programmers often use this construct to group their methods within a class.
Xcode knows about it, too.

Look how the #pragma mark works in the following captured image.


#source: example from The Big Nerd Ranch Guide - Objective C
-------------------------------------------------------------------------------------------------------
More information from [iOS developer:tips];

Xcode and #pragma mark
Posted on September 30, 2008 by John Muchow in Xcode


I’ve started using #pragma mark directives in my code to help with organization as my implementation files grow. #pragma mark is simple to use, for example, insert the following to call out initialization code:
1
2
#pragma mark -
#pragma mark Initialization
Once this is in place, the Functions Menu (in the navigation bar) which shows a list of locations within a source file (e.g. definitions of classes, functions and methods) will display a new marker with the label "Initialization." The code in line 1 will add a line separator inside the Functions Menu, in this example, with the line appearing above the "Initialization" marker.
The figure that follows shows an example of how you might use #pragma mark to divide up various sections of your code.


More recently discuss at linkedin

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου