按字母顺序显示数据iphone [英] display data in alphabetical order iphone

查看:107
本文介绍了按字母顺序显示数据iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在UITableView中按字母顺序显示xml解析数据?

How to display xml parsed Data in UITableView In alphabetical order.?

推荐答案

为了显示/排列您的数据字母表,你必须使用数组 NSSortDescriptor

In order to display/arrange your data in alphabetical which in a array you have to use NSSortDescriptor

你必须使这个<$ c $的对象c> NSSortDescriptor 类并在此处提供您从XML获取的数据

you have to make the object of this NSSortDescriptor class and give data here which you are fetching from XML

NSSortDescriptor *itemXml = [[NSSortDescriptor alloc] initWithKey:@"itemName" ascending:YES];

现在假设你有一个数组sortDescriptors

Now suppose you have an array sortDescriptors

NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:itemXml,nil];


[yourArray sortUsingDescriptors:sortDescriptors];

现在将yourArray提供给 UITableView 委托方法......你将得到表格上的排序数据

Now give the yourArray to your UITableView delegate methods...... you will get the sorted data on table

这篇关于按字母顺序显示数据iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆