Q:

Use #define to replace code

There is a chuck of code in my iOS application which I have to use in every view - can't have it in a function/methods - so I was wondering if there is any way I can use #define and use it's identifier where it is required.  Below is sample code. 
The Code Which I would like to replace with #deinfe identifer
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(_gotECSlidingViewAnchorRightOrRightrNotification) 
                                             name:ECSlidingViewTopDidAnchorLeft 
                                           object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(_gotECSlidingViewAnchorRightOrRightrNotification) 
                                             name:ECSlidingViewTopDidAnchorRight 
                                           object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(_gotECSlidingViewTopDidResetNotification)
                                             name:ECSlidingViewTopDidReset 
                                           object:nil];

So I was wondering how I can can #define it and use it within ViewDidLoad Method? 

A:

You can use this :
Put \ after a space at the end of each line, this prevents the compiler to check for new line or enter key pressed.  This makes the code readable.  Then you can use MY_NOTIFICATIONS any where in your method. 
#define MY_NOTIFICATIONS [[NSNotificationCenter defaultCenter] addObserver:self \
selector:@selector(_gotECSlidingViewAnchorRightOrRightrNotification) \
name:ECSlidingViewTopDidAnchorLeft \
object:nil]; \
\
[[NSNotificationCenter defaultCenter] addObserver:self \
                                         selector:@selector (_gotECSlidingViewAnchorRightOrRightrNotification) \
                                             name:ECSlidingViewTopDidAnchorRight \
                                           object:nil]; \
\
[[NSNotificationCenter defaultCenter] addObserver:self \
                                         selector:@selector(_gotECSlidingViewTopDidResetNotification) \
                                             name:ECSlidingViewTopDidReset \
                                           object:nil]; \

