Set NSString in Constant file and use that string in entire Application with NSString stringWithFormat

Constant, UIDevice, NSString

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

NSString *stringImageURL;

    stringImageURL = [NSString stringWithFormat:SERVER_IMAGE_URL_SMALL,self.farm,self.server,self.aid,self.secret];

Leave a comment