开发者

Sorting multiple NSMutableArrays

开发者 https://www.devze.com 2022-12-11 08:50 出处:网络
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 s

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号