Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (NSComparator)^(id a, id b) {
- // check if user a or user b has unread message
- if( [(UserInfo*)a unreadMsg] > 0 && [(UserInfo*)b unreadMsg] <= 0 ) { // a has but b
- return a;
- }
- else if [(UserInfo*)a unreadMsg] <= 0 && [(UserInfo*)b unreadMsg] > 0 ) { // b has but a
- return b;
- }
- else { // both have unread msg or neither has unread msg
- // then check distance
- if ([(UserInfo*)a distance] < [(UserInfo*)b distance]) {
- return a;
- }
- else {
- return b;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement