Я использую изменяемый массив. Я не уверен, что это правильный способ управления массивом. Я попытался изучить основы управления памятью, но мне было слишком сложно понять. Что я делаюПравильный способ управления массивом
объявить массив на границе
@interface myVC()
@property (nonatomic,strong) NSMutableArray *substrings; // if I use weak attribute here,does it change anything?
@end
-(void)myMethod{
// initializing the array
_substrings=[[NSMutableArray alloc]init];
//storing some data into it
[_substrings addObject:@"hello"];
//do something with the data in that array
//call another method which gets the data from this same array and do some operations there
[self method2];-----> // I access data from the array like, x=[_substrings objectatindex:0];
//finally, remove the items in the array
[_substrings removeObject:@"hello"];
//and again start the process as mentioned here
}
Это то, что я имею в виду сделать. Является ли это правильным способом объявления и доступа к массиву?