DropDown Menu Animation

@interface ViewController ()
{
    BOOL Condi;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    viewPOPDown.frame = CGRectMake(viewPOPDown.frame.origin.x, viewPOPDown.frame.origin.y, viewPOPDown.frame.size.width, 0);
}

- (IBAction)ActionDown:(id)sender
{
    
    if (Condi == false)
    {
        viewPOPDown.hidden = NO;
        
        [UIView animateWithDuration:0.3f animations:^{
            viewPOPDown.frame =
            CGRectMake(viewPOPDown.frame.origin.x,
                       viewPOPDown.frame.origin.y,
                       viewPOPDown.frame.size.width,
                       300);
            Condi = true;

        }];
        
        
        NSLog(@"viewPOPDown: %f",viewPOPDown.frame.size.height);
        
    }
    else if (Condi == true)
    {
        NSLog(@"viewPOPDown: %f",viewPOPDown.frame.size.height);

        [UIView animateWithDuration:0.3f animations:^{
            viewPOPDown.frame =
            CGRectMake(viewPOPDown.frame.origin.x,
                       viewPOPDown.frame.origin.y,
                       viewPOPDown.frame.size.width,
                       0);
            Condi = false;
        }];
        
        NSLog(@"viewPOPDown: %f",viewPOPDown.frame.size.height);
    }
}

Header Token Pass (AFNetworking)


NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
   
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDAnimationFade;
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    
    [manager.requestSerializer setValue:[NSString stringWithFormat:@"Bearer %@", [defaults valueForKey:@"token"]] forHTTPHeaderField:@"Authorization"];
    
    [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    
    [manager POST:[NSString stringWithFormat:@"%@/logout",BASEURL] parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject)
     {
}

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))

Notification Center


- (void)viewDidLoad
{
   //Declare 
   [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshTableWithNotification:) name:@"Refresh" object:nil];
}

//Action Perform
- (void)refreshTableWithNotification:(NSNotification *)notification
{
    NSLog(@"Action Performed");
}

//Other Class Through Access Above Method
- (IBAction)ActionNotification:(id)sender
{
   [[NSNotificationCenter defaultCenter] postNotificationName:@"Refresh" object:nil userInfo:nil];
}

Push Notification

Three Method
1. didRegisterForRemoteNotificationsWithDeviceToken
2. didReceiveRemoteNotification
3. didFailToRegisterForRemoteNotificationsWithError

AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
    {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    }
    else
    {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
         (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
    }
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSString * deviceTokenString = [[[[deviceToken description] stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""] stringByReplacingOccurrencesOfString: @" " withString: @""];
    
    NSLog(@"the generated device token string is : %@",deviceTokenString);
    
    [[NSUserDefaults standardUserDefaults] setObject:deviceTokenString forKey:@"DeviceToken"];
    
    NSLog(@"%@",[[NSUserDefaults standardUserDefaults]valueForKey:@"DeviceToken"]);

}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler
{
    NSLog(@"%@",userInfo);
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    NSLog(@"Did Fail to Register for Remote Notifications");

    NSLog(@"%@, %@", error, error.localizedDescription);
}

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.