1,维护 一个置顶列表,即可,与服务器没有关系,只是 前台一个显示策略,
跟 爱康360 里面的 用药提醒设置是 一样的, 也是本地记忆的,
//写入缓存列表
-(void)storeSettingChatList:(UITapGestureRecognizer *)sender
{
if (sender.state == UIGestureRecognizerStateEnded) {
UIView *gestureView =sender.view;
MessageListInfo *info = [self.dataArray objectAtIndex:gestureView.tag];
[self.dataArray removeObject:info];
[self.dataArray insertObject:info atIndex:0];
[self.tableView reloadData];
NSMutableArray *messageListArray = [TTCacheUtil objectFromFile:MESSAGE_QUEUE];
if (!messageListArray) {
messageListArray = [[NSMutableArray alloc] init];
}
if ([messageListArray containsObject:info]) {
[messageListArray removeObject:info];
}
[messageListArray insertObject:info atIndex:messageListArray.count];
[TTCacheUtil writeObject:messageListArray toFile:MESSAGE_QUEUE];
}
}
-(void)adjustMessageDataArrayOrder
{
NSMutableArray *messageListArray = [TTCacheUtil objectFromFile:MESSAGE_QUEUE];
for (MessageListInfo *info in messageListArray) {
int messageId = info.idNumber;
for (int i = 0;i<self.dataArray.count;i++) {
MessageListInfo *listInfo = [self.dataArray objectAtIndex:i];
if (listInfo.idNumber == messageId) {
[self.dataArray removeObjectAtIndex:i];
//[self.dataArray removeObject:listInfo];
[self.dataArray insertObject:listInfo atIndex:0];
}
}
}
}