Reputation: 2855
I have declared a NSMutable Array with 50 size. As i want to use each index as an array and add data separately. e.g i want to add 10 object to first Index 5 to next and so on. Is this the right way to do it? Please help me out if there is an alternate way.The sdk gives me error at line 5 saying 'Cannot convert to a pointer type'.
NSMutableArray *myArray[50];
@property (nonatomic, retain) NSMutableArray *myArray;
@dynamic myArray;
for (int i = 0; i < count; i++)
{
myArray[i] = [NSMutableArray alloc];
}
PresentationSlides[i] addObject:string];
My problem is how can i reach to a specific index.if i use this.
for (int i = 0; i < count; i++)
{
myArray = [NSMutableArray array];
}
[myArray objectAtIndex:i ??????
What else? I am stuck in the projet after completing 90% of it. And there is no use of it if i couldnt complete it.
Upvotes: 0
Views: 983
Reputation: 23390
You'll have to allocate myArray:
myArray = [NSMutableArray arrayWithCapacity:50];
Then for line 5, in the loop, 'alloc' alone isn't enough. Try:
[myArray insertObject:[[NSMutableArray alloc] initWithCapacity:10] atIndex:i];
Upvotes: 2