2

I wanted to sort the integer values of my NSMutableArray. I don't know to to do it.

Any help please

2
  • It's not duplicate @kennytm look at the Question. I specified what kind of array. The answer in the Sorting Array in increasing order is not for NSMutableArray its for NSArray. Commented Mar 24, 2017 at 6:31
  • Updated duplicate link. Commented Mar 24, 2017 at 6:57

1 Answer 1

3
NSMutableArray *array = /* loaded from file */;

array = [NSMutableArray arrayWithArray:[array sortedArrayUsingSelector: @selector(compare:)]];
[array sortedArrayUsingSelector: @selector(compare:)];
Sign up to request clarification or add additional context in comments.

5 Comments

I specified NSMutableArray not NSArray. Sorry
you can simply convert NSArray and NSMutableArray.
Hmm. I already solved my issue on my own. by this code [modifiedArray sortUsingSelector:@selector(compare:)]; . We'll that's a good answer too. Thanks . Please upvote my question and I will upvote your answer plus I will mark it check @iCoderz
You can up vote if it is working. @handiansom
You solution is working the same as mine.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.