Defining a constant screen width

I have a constant with a screen width of up to 320. This is used in several places in my code. I have to change this to accept the value from the current device, and I do not want to touch all of these places. So, I want to define a constant for this with a value:

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

But it gives me a lot of compilation errors. Any clue?

+4
source share
1 answer
 [[UIScreen mainScreen] applicationFrame].size.width 
+9
source

Source: https://habr.com/ru/post/1339924/


All Articles