NSUInteger arrayLength = [annotations count];
UILabel* arrayLengthLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 100, 200, 100)];
arrayLengthLabel.text = @"%@", arrayLength;
[self.view addSubview:arrayLengthLabel];
I have the above code, which I have researched.
The problem is when outputting the arrays length count to the label.
I should have 4 elements in the array, but this is not outputting the number of elements, and I am sure I am making a schoolboy error here.
Cheers for help in advance
Here is the code I would use:
I’m using a standard int and using the code
%iinstead of%@. This may be your issue. I don’t know offhand if anNSUIntegerrequires%i, but I definitely knowintuses%i.Also, I don’t know if your way of doing an
NSStringworks without testing, so I’ve used the “full” format, which I know definitely works.