Set device height and width in constant file and use in entire application

Constant, UIDevice

Right side bundle right click on any file

iOS – Sourse – Header File

Save as – Constant.h

Constant.h

#ifndef Constant_h

#define Constant_h

#define NETWORK_NOT_REACHEBLE_MESSAGE @“Please check you Internet Connection”

#define HT  [UIScreen mainScreen].bounds.size.height

#define WD  [UIScreen mainScreen].bounds.size.width

#define SERVER_URL @https://api.flickr.com/services/”

#define SERVER_IMAGE_URL @https://farm%@.staticflickr.com/%@/%@_%@.jpg”

#define SERVER_IMAGE_URL_SMALL @https://farm%@.staticflickr.com/%@/%@_%@_s.jpg”

#endif /* Constant_h */

ViewController.h

#import “Constant.h”

NSLog(@”%f”,WD);

    NSLog(@”%f”,HT);

Leave a comment