Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to create separate file for all the constants of my project

In my project I have a requirement to create separate file for all constants that i am using in separate classes in the same project.

I seen some examples but they are saying about creating in '.h' file and again they are implementing them in '.m' files. But i need only '.h'file to create all constants and i have to use all those constants by importing that '.h' file in every class of my project.

like image 783
KrishnaTeja Avatar asked Feb 18 '13 10:02

KrishnaTeja


1 Answers

enter image description here ADD a new file.

  • Right click on the file inspector
  • choose New File
  • The pop up window select ios>C and C++>HeaderFile[Figure]
  • Give name Constants
  • Add #define OK @"OK"
  • Go to View Controller include file in header #import "Constants.h" OR Define in pch file ,so that all View controllers can access the file
  • In viewDidLoad NSLog(@"%@",OK);
like image 112
Lithu T.V Avatar answered Sep 27 '22 22:09

Lithu T.V