[XMPP]iOS聊天软件学习笔记[一]
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
通过前面的学习后,准备开始正式自己写一个项目
开发时间:五天(工作时间)
开发工具:xcode6
开发平台:iOS8
XMPP框架:XMPPFramework
git clone https://github.com/robbiehanson/XMPPFramework.git
界面设计:使用StoryBoard
github地址:https://github.com/hjandyz/XMPP
第一天基本完成了“其他登陆”界面,这里只将注意点做笔记
1.枚举和block的定义并用于回调
typedef enum {
XMPPResultTypeLoginSuccess,
XMPPResultTypeLoginFailure,
XMPPResultTypeNetErr
}XMPPResultType;
typedef void (^XMPPRresultBlock)(XMPPResultType type);
if (error && _resultBlock) {
_resultBlock(XMPPResultTypeNetErr);
}
if (_resultBlock) {
_resultBlock(XMPPResultTypeLoginSuccess);
}
2.block内要把self设置成弱指针
__weak typeof (self) weekSelf = self;
[delegate xmppUserLogin:^(XMPPResultType type) {
[weekSelf handleResultTye:type];
}];
3.切换rootViewComtroller时记得dismiss模态窗口,不然会造成内存泄漏
//隐藏模态窗口
[self dismissViewControllerAnimated:YES completion:nil];
4.建立新连接前如果已经建立过连接要断开
//如果以前连接过要断开
[_XMPPStream disconnect];
//连接主机
[self connentToHost];
5.MBProgressHUD如果view为nil会显示到window上面去
[MBProgressHUD showHUDAddedTo:view animated:YES]
6.自定义Log的方法
//自定义log
#ifdef DEBUG
#define HJLog(...) NSLog(@"%s %@",__func__,[NSString stringWithFormat:__VA_ARGS__])
#else
#define HJLog(...)
#endif
[XMPP]iOS聊天软件学习笔记[一]的更多相关文章
- [XMPP]iOS聊天软件学习笔记[四]
昨天完成了聊天界面,基本功能算告一段落 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework git clone https://githu ...
- [XMPP]iOS聊天软件学习笔记[三]
今天做了好友界面,其实xmpp内部已经写好很多扩展模块,所以使用起来还是很方便的 开发时间:五天(工作时间) 开发工具:xcode6 开发平台:iOS8 XMPP框架:XMPPFramework gi ...
- [XMPP]iOS聊天软件学习笔记[二]
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- cocos2d-x 3.1.1学习笔记[23]寻找主循环 mainloop
文章出自于 http://blog.csdn.net/zhouyunxuan cocos2d到底是怎样把场景展示给我们的,我一直非常好奇. 凭个人猜想,引擎内部的结构类似于这样 while(true ...
- cocos2d-x 3.1.1 学习笔记[21]cocos2d-x 创建过程
文章出自于 http://blog.csdn.net/zhouyunxuan RootViewController.h #import <UIKit/UIKit.h> @interfac ...
- cocos2d-x 3.1.1 学习笔记[3]Action 动作
这些动画貌似都非常多的样子,就所有都创建一次. 代码例如以下: /* 动画*/ auto sp = Sprite::create("card_bg_big_26.jpg"); Si ...
- cocos2d-x 3.1.1 学习笔记[2]Sprite 精灵
Sprite应该是用到最多的一个类吧.无法想像一个游戏没有精灵将怎样进行愉快的玩耍. Sprite继承于Node 和 TextureProtocol. Sprite是一个2d的图像. Sprite能够 ...
- cocos2d-x 3.1.1 学习笔记[17] 关于这些活动功能
供cocos2d-x通常使用的方法,我有一个好脸色.这项研究真的奖励. 向导首先,定义,实施一系列连续动作. 对于我们的行动能回调函数,我们必须申报并加以实施. void callBack(); vo ...
- cocos2d-x 3.1.1 学习笔记[4]GridActions 网格动画
文章写的 http://blog.csdn.net/zhouyunxuan 老样子.见代码. //GridActions can only used on NodeGrid auto nodeGri ...
随机推荐
- CSU 1335 高桥和低桥
开始队友说是线段树,看了看貌似也是,上手敲了个嵌套的线段树,O(nlognlogn)的复杂度果断tle了 TAT 思路:对h[i]排序,对每次涨水退水,先用二分查找,再用一个数组保存当前点之后所有点被 ...
- str_翻转字符串
1. 给一个句子,翻转每个单词,单词内部不翻转 $str = "dog loves pig"; $ret = turnSentence($str); var_dump($ret); ...
- [UVA] 11991 - Easy Problem from Rujia Liu? [STL应用]
11991 - Easy Problem from Rujia Liu? Time limit: 1.000 seconds Problem E Easy Problem from Rujia Liu ...
- 转载收藏之用 - 微信公众平台开发教程(六):了解MessageHandler
上一篇<Senparc.Weixin.MP SDK 微信公众平台开发教程(五):使用Senparc.Weixin.MP SDK>我们讲述了如何使用Senparc.Weixin.MP SDK ...
- 《Programming WPF》翻译 第6章 5.我们进行到哪里了?
原文:<Programming WPF>翻译 第6章 5.我们进行到哪里了? WPF提供了资源工具,让我们运用在用户界面中,动态并具有一致性.我们可以在资源字典中存储任意资源,并且可以遍及 ...
- Longest Consecutive Sequence 解答
Question Given an unsorted array of integers, find the length of the longest consecutive elements se ...
- Sum 类型题目总结
Sum类的题目一般这样: input: nums[], target output: satisfied arrays/ lists/ number 拿到题目,首先分析: 1. 是几个数的sum 2. ...
- Longest Valid Parentheses 解答
Question Given a string containing just the characters '(' and ')', find the length of the longest v ...
- 【HDU1198】Farm Irrigation(回溯+记忆化搜索)
数据流小,深搜即可.有些暴力.看其他人的题解用二维转换成一维做的并查集很巧妙,马上去研究一下!! #include <iostream> #include <cstring> ...
- qt坐标系统
#说明:坐标系统是由 QPainter控制的QPaintDevice是那些能够让 QPainter 进行绘制的“东西”(准确的术语叫做,二维空间)# 的抽象层(其子类有QWidget. QPixmap ...