ios - Sort by string and ignore number for display in UITableView -
i need sort alphabetic data in table view , ignore numbers, :
- 123 test - 939 urne - 403 vase
currently, data loaded this:
- 939 urne - 123 test - 403 vase
what's best choice ignoring numbers?
you can store data separately in dictionaries, like,
array ( { "number" = 403 "text" = "vase" }, { "number" = 403 "text" = "vase" } )
then can sort using,
nssortdescriptor * descriptor = [nssortdescriptor sortdescriptorwithkey:@"text" ascending:yes]; [array sortusingdescriptors:[nsarray arraywithobject:descriptor]];
Comments
Post a Comment