Sorting multiple NSMutableArrays
I have high scores (name, score, time) stored in a single file and I divide them into separate arrays once it reads them, only problem is I can't figure out开发者_如何学C a way to sort all three by score and time from least to greatest and still keep the correct order of values. For example:
Name score time
---------------
nathan 123 01:12
bob 321 55:32
frank 222 44:44
turns to:
bob 123 01:12
frank 222 44:44
nathan 321 55:32
Encapsulate the data into a single object (HighScore
) that has three properties: name
, time
, and score
. Then store them in a single array and sort the single array.
Welcome to object-oriented programming.
精彩评论