Change Font Device Wise

#define PROPORTIONAL_FONT_SIZE(s)
(s + (IS_IPHONE_4_OR_LESS ? -3 : 0) + (IS_IPHONE_5 ? -2 : 0) +
(IS_IPHONE_6 ? -1 : 0) + (IS_IPHONE_6P ? 0 : 0))
DEVICE TYPE
#pragma mark - DEVICE TYPE MACROS
#pragma mark -

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

DEVICE DIMENSION

#pragma mark - DEVICE DIMENSION MACROS
#pragma mark -

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

FONT MACROS

#pragma mark - FONT MACROS
#pragma mark -

#define FONT_FAMILY_REGULAR @"CenturyGothic"
#define FONT_FAMILY_BOLD @"CenturyGothic-Bold"
#define FONT_FAMILY_SEMIBOLD @""

#define REGULAR_FONT(s)                                                        \
[UIFont fontWithName:FONT_FAMILY_REGULAR size:PROPORTIONAL_FONT_SIZE(s)]
#define BOLD_FONT(s)                                                           \
[UIFont fontWithName:FONT_FAMILY_BOLD size:PROPORTIONAL_FONT_SIZE(s)]
#define SEMI_BOLD_FONT(s)                                                      \
[UIFont fontWithName:FONT_FAMILY_SEMIBOLD size:PROPORTIONAL_FONT_SIZE(s)]

#define PROPORTIONAL_FONT_SIZE(s)                                              \
(s + (IS_IPHONE_4_OR_LESS ? -3 : 0) + (IS_IPHONE_5 ? -2 : 0) +                \
(IS_IPHONE_6 ? -1 : 0) + (IS_IPHONE_6P ? 0 : 0))

Types of UIGestureRecognizer

Refrence

1. UITapGestureRecognizer :

This class regards the tap gestures made on a view. It can be used to handle single or multiple taps, either with one or more fingers. Tapping is one of the most usual gestures that users make.

2. UISwipeGestureRecognizer :

Another important gesture is the swipe, and this class exists just for it. Swiping happens when dragging a finger towards a direction (right, left, top and down). A characteristic example of the swipe gesture exists on the Photos app, where we use our fingers to slide from one photo to another.

3. UIPanGestureRecognizer :

The pan gesture is actually a drag gesture. It’s used when it’s needed to drag views from one point to another.

4. UIPinchGestureRecognizer :

When you view photos on the Photos app and you use your two fingers to zoom in or out to a photo, then you perform a pinch gesture. As you understand, pinching requires two fingers. An object of this class is usually handy to change the transform of a view, and more specifically its scale. Using pinch gestures for example, you can implement zoom in and out to photos on your own apps.

5. UIRotationGestureRecognizer :

In accordance to the previous gesture, rotation is used to rotate a view using two fingers.

6. UILongPressGestureRecognizer :

An object of that class monitors for long press gestures happening on a view. The pressing must last long enough in order to be detected, and the finger or fingers should not move a lot around the pressed point otherwise the gesture fails.

7. UIScreenEdgePanGestureRecognizer :

This one is similar to the swipe gesture, but with a great difference: The finger movement should always begin from an edge of the screen.

What are blocks and how are they used?

Refence

Blocks are a way of defining a single task or unit of behavior without having to write an entire Objective-C class. Under the covers Blocks are still Objective C objects. They are a language level feature that allow programming techniques like lambdas and closures to be supported in Objective-C. Creating a block is done using the ^ { } syntax:

myBlock = ^{
   NSLog(@"This is a block");
}

It can be invoked like so:

myBlock();

It is essentially a function pointer which also has a signature that can be used to enforce type safety at compile and runtime. For example you can pass a block with a specific signature to a method like so:

- (void)callMyBlock:(void (^)(void))callbackBlock;

If you wanted the block to be given some data you can change the signature to include them:

- (void)callMyBlock:(void (^)(double, double))block 
{
    ...
    block(3.0, 2.0);
}

What’s the difference between not-running, inactive, active, background and suspended execution states?

  • Not running: The app has not been launched or was running but was terminated by the system.
  • Inactive: The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state.
  • Active: The app is running in the foreground and is receiving events. This is the normal mode for foreground apps.
  • Background: The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time may remain in this state for a period of time. In addition, an app being launched directly into the background enters this state instead of the inactive state.
  • Suspended: The app is in the background but is not executing code. The system moves apps to this state automatically and does not notify them before doing so. While suspended, an app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.