Hi guyz,
i'm new here and i have one doubt about creating variables.
I have a variable that get the screen size of the device declared inside a method, but i need it to be out of the scope to all my methods inside the same class (just for the same class).
I dont want to pass it by arguments to every method, so i need a private visible variable for this class.
How can i do that?
Right now i have:
I declared it only in the .m file
It's that correct? i never use static in C#, for me static means visible for ALL class and i dont want that, i just need it for this class. also... it's there a problem for not declaring it at my .h file?
Thanxs!
i'm new here and i have one doubt about creating variables.
I have a variable that get the screen size of the device declared inside a method, but i need it to be out of the scope to all my methods inside the same class (just for the same class).
I dont want to pass it by arguments to every method, so i need a private visible variable for this class.
How can i do that?
Right now i have:
I declared it only in the .m file
Code:
@interface ViewController ()
@end
@implementation ViewController
@synthesize seleccion,button1,button2,button3;
static CGRect screenBound;
static CGFloat screenWidth;
static CGFloat screenHeight;
- (void)viewDidLoad
{
//Get Screen Size
screenBound = [[UIScreen mainScreen] bounds];
screenWidth = screenBound.size.width;
screenHeight = screenBound.size.height;
//Lot of methods who use the screen size here
bla bla bla
}
It's that correct? i never use static in C#, for me static means visible for ALL class and i dont want that, i just need it for this class. also... it's there a problem for not declaring it at my .h file?
Thanxs!