iOS关闭QQ通知,怎么设置QQ联系人在通知消息弹窗

&nbsp>&nbsp
&nbsp>&nbsp
&nbsp>&nbsp
iOS开发-仿QQ好友列表展开/关闭
摘要:前言:前端时间小编的一个朋友要做一个类似QQ列表的展开与关闭的效果,于是小编在闲暇之余给他写了一个demo,本着好东西大家一起来分享的精神,趁着今天有时间小编把这个demo在此与大家一起共享,希望能够帮到有需要的朋友。原理:使用UITableView列表形式,对sectionHeaderView添加tap手势,点击展开/关闭该section通过对每个section记录一个是否展开的BOOL值来实现。小编没有做很细化的效果,先看看简单效果图如下:未展开.png展开.png下面来
前言:前端时间小编的一个朋友要做一个类似QQ列表的展开与关闭的效果,于是小编在闲暇之余给他写了一个demo,本着好东西大家一起来分享的精神,趁着今天有时间小编把这个demo在此与大家一起共享,希望能够帮到有需要的朋友。
原理:使用UITableView列表形式,对sectionHeaderView添加tap手势,点击展开/关闭该section通过对每个section记录一个是否展开的BOOL值来实现。
小编没有做很细化的效果,先看看简单效果图如下:
未展开.png
下面来介绍代码的实现:由于没有网络数据,小编只能自己伪造了一些假数据,大家在使用的时候替换掉就可以了。
#import &ViewController.h&
#import &QQFriendCell.h&
#define Cell_QQFriend @&Cell_QQFriend_ID&
@interface ViewController () &UITableViewDelegate, UITableViewDataSource&
@property (nonatomic, strong) UITableView * tableV
@property (nonatomic, strong) NSMutableArray * dataA
//每组的标题
@property (nonatomic, strong) NSMutableArray * sectionA
//存储是否展开的BOOL值
@property (nonatomic, strong) NSMutableArray * boolA
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @&好友列表&;
[self loadData];
[self addSubviews];
[self makeConstraintsForUI];
//加载数据
- (void)loadData {
NSArray * secArr = @[@&我的好友&, @&小学同学&, @&初中同学&, @&高中同学&, @&大学同学&];
NSArray * rowsArr = @[@(12), @(10), @(15), @(13), @(22)];
for (int i = 0; i & secArr. i++) {
NSMutableArray * friendArr = [[NSMutableArray alloc] init];
for (int j = 0; j & [rowsArr[i] intValue]; j++) {
[friendArr addObject:@(j)];
[self.dataArr addObject:friendArr];
[self.sectionArr addObject:secArr[i]];
[self.boolArr addObject:@NO];
#pragma mark - add subviews
- (void)addSubviews {
[self.view addSubview:self.tableView];
#pragma mark - make constraints
- (void)makeConstraintsForUI {
[_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(Screen_Width, Screen_Height));
make.left.mas_equalTo(@0);
make.top.mas_equalTo(@0);
#pragma mark - tableView delegate and dataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.dataArr.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//判断是否展开,如果未展开则返回0
if ([self.boolArr[section] boolValue] == NO) {
return [self.dataArr[section] count];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
QQFriendCell * cell = [tableView dequeueReusableCellWithIdentifier:Cell_QQFriend forIndexPath:indexPath];
if (indexPath.row & [self.dataArr[indexPath.section] count]) {
//这里可以传入请求的数据,此方法可以根据自己的需求做更改
[cell configCellWithData:nil row:indexPath.row];
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
//创建header的view
UIView * headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, 50)];
headerView.tag = 2016 +
headerView.backgroundColor = [UIColor colorWithRed:235/255.0 green:235/255.0 blue:235/255.0 alpha:1];
//添加imageview
UIImageView * iv = [[UIImageView alloc] initWithFrame:CGRectMake(10, 15, 20, 20)];
//三目运算选择展开或者闭合时候的图标
iv.image = [_boolArr[section] boolValue] ? [UIImage imageNamed:@&buddy_header_arrow_down&] : [UIImage imageNamed:@&buddy_header_arrow_right&];
[headerView addSubview:iv];
//添加标题label
UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(35, 0, Screen_Width - 100, 50)];
label.text = self.sectionArr[section];
[headerView addSubview:label];
//添加分组人数和在线人数显示的label
UILabel * labelR = [[UILabel alloc] initWithFrame:CGRectMake(Screen_Width - 60, 0, 60, 50)];
labelR.textAlignment = NSTextAlignmentC
//这里小编把在线人数全部设置成了0,可以根据需求更改
labelR.text = [NSString stringWithFormat:@&%d/%lu&, 0, [self.dataArr[section] count]];
[headerView addSubview:labelR];
//添加轻扣手势
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGR:)];
[headerView addGestureRecognizer:tap];
return headerV
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 50;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 70;
#pragma mark - action
- (void)tapGR:(UITapGestureRecognizer *)tapGR {
//获取section
NSInteger section = tapGR.view.tag - 2016;
//判断改变bool值
if ([_boolArr[section] boolValue] == YES) {
[_boolArr replaceObjectAtIndex:section withObject:@NO];
[_boolArr replaceObjectAtIndex:section withObject:@YES];
//刷新某个section
[_tableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:UITableViewRowAnimationFade];
#pragma mark - setter and getter
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] init];
_tableView.delegate =
_tableView.dataSource =
[_tableView registerClass:[QQFriendCell class] forCellReuseIdentifier:Cell_QQFriend];
//下面这行代码可以避免分组都没展开时,空白处出现的横线
_tableView.tableFooterView = [[UIView alloc] init];
return _tableV
- (NSMutableArray *)dataArr {
if (!_dataArr) {
_dataArr = [[NSMutableArray alloc] init];
return _dataA
- (NSMutableArray *)sectionArr {
if (!_sectionArr) {
_sectionArr = [[NSMutableArray alloc] init];
return _sectionA
- (NSMutableArray *)boolArr {
if (!_boolArr) {
_boolArr = [[NSMutableArray alloc] init];
return _boolA
上边是ViewController里边的代码,小编对Cell也进行了简单的定制,同时SectionHeaderView在此写的有些复杂,代码比较多,其实可以单独拉出来进行定制,定制之后再次调用会看起来清爽很多,但是小编时间有限就没有定制,只是对Cell进行了简单的定制,在此只看.m中的代码即可:
#import &QQFriendCell.h&
@interface QQFriendCell ()
@property (nonatomic, strong) UIImageView * image_
@property (nonatomic, strong) UILabel * lab_
@property (nonatomic, strong) UILabel * lab_
@implementation QQFriendCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self addSubviews];
#pragma mark - add subviews
- (void)addSubviews {
[self addSubview:self.image_icon];
[self addSubview:self.lab_nickname];
[self addSubview:self.lab_signature];
#pragma mark - layout subviews
- (void)layoutSubviews {
[super layoutSubviews];
[_image_icon mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(50, 50));
make.left.mas_equalTo(@15);
make.top.mas_equalTo(@10);
[_lab_nickname mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(_image_icon.mas_top);
make.left.mas_equalTo(_image_icon.mas_right).with.offset(15);
make.right.mas_equalTo(@-15);
make.height.mas_equalTo(@21);
[_lab_signature mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(_image_icon.mas_bottom);
make.left.mas_equalTo(_lab_nickname.mas_left);
make.right.mas_equalTo(_lab_nickname.mas_right);
make.height.mas_equalTo(@21);
#pragma mark - config cell
//此方法为外漏方法,可以根据自己的需求更改
- (void)configCellWithData:(NSDictionary *)dic row:(NSInteger)row {
_image_icon.backgroundColor = [UIColor colorWithRed:arc4random()%255/255.0 green:arc4random()%255/255.0 blue:arc4random()%255/255.0 alpha:1.0];
_lab_nickname.text = [NSString stringWithFormat:@&好友%lu&, row + 1];
_lab_signature.text = [NSString stringWithFormat:@&这是好友%lu的签名&, row + 1];
#pragma mark - setter and getter
- (UIImageView *)image_icon {
if (!_image_icon) {
_image_icon = [[UIImageView alloc] init];
_image_icon.contentMode = UIViewContentModeScaleAspectF
_image_icon.layer.cornerRadius = 25.0;
_image_icon.layer.masksToBounds = YES;
return _image_
- (UILabel *)lab_nickname {
if (!_lab_nickname) {
_lab_nickname = [[UILabel alloc] init];
_lab_nickname.font = [UIFont systemFontOfSize:18];
return _lab_
看到这里就结束了,是不是很简单呢,其实只要知道点击展开/关闭的原理,相信大家都可以写出效果来的。
总结一下此demo用到的几个关键的点:1、需要一个存储各个分组是否展开的BOOL值的数组;2、tableView刷新某个Section的动态方法
demo下载地址:https://github.com/guorenhao/TencentQQ.git
最后,小编还是希望此文能够帮助到有需要的朋友们,愿同是程序猿的我们能够共同学习进步,在开发的道路上越走越远!谢谢!
以上是的内容,更多
的内容,请您使用右上方搜索功能获取相关信息。
若你要投稿、删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内给你回复。
云服务器 ECS
可弹性伸缩、安全稳定、简单易用
&40.8元/月起
预测未发生的攻击
&24元/月起
邮箱低至5折
推荐购买再奖现金,最高25%
&200元/3月起
你可能还喜欢
你可能感兴趣
阿里云教程中心为您免费提供
iOS开发-仿QQ好友列表展开/关闭相关信息,包括
的信息,所有iOS开发-仿QQ好友列表展开/关闭相关内容均不代表阿里云的意见!投稿删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内答复
售前咨询热线
支持与服务
资源和社区
关注阿里云
InternationaliOS8.1 QQ锁屏消息关闭方法不让消息内容被他人看到
互联网 & 发布时间: 09:55:53 & 作者:佚名 &
升级iOS8.1系统之后,经常在锁屏界面下弹出QQ消息,如此一来,消息变会让他人看到,导致隐私暴露,关于这个问题如何关闭呢?下面以图文的形式为大家讲解下
  iPhone5S更新升级iOS8.1系统之后,有些用户反映经常在锁屏界面下弹出QQ消息,这样一来,QQ消息内容会被人看光,对隐私有所影响,同时还会消耗一定的电池。所以我们需要对此进行关闭。
  【iOS8.1 QQ锁屏消息关闭方法】
  1、在iOS8.1设备桌面中,点击进入【设置】,然后再进入【通知】设置。
  2、然后在通知设置中,点击【QQ】应用程序通知设置,之后将【允许通知】或【在锁定屏幕上显示】开关,关闭即可。
大家感兴趣的内容
12345678910
最近更新的内容手机 QQ( iOS)不能弹出消息提醒了。 - V2EX
手机 QQ( iOS)不能弹出消息提醒了。
11:55:48 +08:00 &bladecamper
自用的iPhone4s不知道哪天开始手机QQ不能弹出消息通知了,QQ自带的设置和系统设置里的通知都已经打开,为了这个把iOS升级到8.1也不行。
求解决方案
2484 次点击所在节点 &
Winny 14:31:14 +08:00微信遇到了这个问题,没找到到解决方法。
sky300 15:06:40 +08:00偶发性的。。。
bladecamper 16:21:43 +08:00@ 已经持续一个多月都这样了。
sky300 16:24:25 +08:00@ 是差不多一个月了。但是不是所有消息都不提示。偶发性的。我身边朋友也有类似情况。
xiaoyao9933 16:42:10 +08:00试试把路由器的DNS改为8.8.8.8
zhangchioulin 16:49:37 +08:00我的4S也这样,不过我用的CMWAP接入点,收不到是肯定的吧?
第 1 页 / 共 1 页&
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到
上打开本讨论主题的完整版本。
是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
is a community of developers, designers and creative people.手机qq撤回消息并亲了你一下怎么设置|qq撤回消息并亲了你一下怎么设置 IOS手机qq撩妹教程 - 统一手机站
当前位置:& >
> qq撤回消息并亲了你一下怎么设置 IOS手机qq撩妹教程
qq撤回消息并亲了你一下怎么设置 IOS手机qq撩妹教程
编辑:猫木 更新:
扫描二维码随时看1.在手机上浏览2.分享给你的微信好友或朋友圈
猜你感兴趣
【上一篇】
【下一篇】
看完这篇文章有何感觉?
(您的评论需要经过审核才能显示,请文明发言!)&&剩余字数:
点击图片更换

我要回帖

更多关于 联系人变更通知函 的文章

 

随机推荐