Is there any possibility to define arrays in macro in objective-c.
How to define array in Macros in Objective-c?
You can also just do:
#define MY_ARRAY @[ @"foo", @"bar" ]
can u tell me how to declare array of long value in #define? –
Bicameral
Yes, you can define arrays in macros. e.g
#define MY_ARRAY [NSMutableArray arrayWithObjects:someObj1, someObj2, nil]
@Renter Can you pls tell how to access or retrieve this. –
Blumenfeld
It would be the same as you would use an NSMutableArray object, e.g
NSLog(@"Object at index 0 is %@",[MY_ARRAY objectAtIndex:0]);
–
Renter how to add aobject ?like :[ MY_ARRAY addobject:@"obj"]; –
Castrato
You can also just do:
#define MY_ARRAY @[ @"foo", @"bar" ]
can u tell me how to declare array of long value in #define? –
Bicameral
© 2022 - 2024 — McMap. All rights reserved.