Articles Tagged '# pragma mark'

Objective-C: Addendum on notifications and delegates

Answer to the question of ILeW with an article about what the real, attaching such as notifications and delegates work. Using a pattern we see first how the delegate pattern:

Delegate

An object in search of a delegate

Continued ...

XCode: organize your code with the # pragma mark

XCode is a very powerful and versatile and provides the programmer with many useful features and simple to use. When writing complex code, or at least articulated, it becomes important to organize your code so you do not waste time searching functions spread in long lines of code. After commenting, the first and most important thing to do, the environment XCode provides guidelines (nice) to improve the usability and legginilitĂ  within the development. One of these is the directive #pragma mark that becomes very useful in organizing groups of the code and methods.

In the picture below you can see the code part of my project PragmaTest :

pragmamark-1

The top dropdown menu allows you to list all the methods of our class. Now if we insert our method over the directive #pragma mark which has a syntax:

1
# Pragma mark {label}

We get:

pragmamark-2

The first #pragma mark with a hyphen (-) inserts a separator line. The second is a text (label) to taste. You can add the following statement where you want, organizing the code as you see fit. You can enter more pragmatic lines, type:

1
2
3
4
5
6
# Pragma mark -
# Pragma mark / **
# Pragma mark * Using the pragma
# Pragma mark * on several lines of code
# Pragma mark * /
void ) mioMetodo { } - (Void) {} myMethod

Continued ...