zoukankan      html  css  js  c++  java
  • 聊天信息 置顶,

    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];

                }

            }

        }

       

    }

  • 相关阅读:
    (九)SpringBoot之错误处理
    (九)SpringBoot之使用jsp
    (八)SpringBoot之freeMarker基本使用
    (七)freemarker的基本语法及入门基础
    (六)Spring Boot之日志配置-logback和log4j2
    (五)Spring Boot之@RestController注解和ConfigurationProperties配置多个属性
    (四)Spring Boot之配置文件-多环境配置
    HashPayloadPcapReader
    Wireshark理解TCP乱序重组和HTTP解析渲染
    Centos定时启动和清除任务
  • 原文地址:https://www.cnblogs.com/guligei/p/3284565.html
Copyright © 2011-2022 走看看