01 2014 档案

摘要:NSString *contentStr = [NSString stringWithFormat:@"你和%@还是陌生人,听歌时送花给TA可以开启留言", friendInfo.nickName]; NSMutableAttributedString * tttstring = [[NSMutab 阅读全文
posted @ 2014-01-28 17:43 路在脚下, 阅读(475) 评论(0) 推荐(0) 编辑
摘要:update instantMessage set state = '8', networkPath = 'http://192.168.0.249/zcl/php/Public/uploads/20140126/52e4c1ecb4884.jpg' ,sNetworkPath = 'http://192.168.0.249/zcl/php/Public/uploads/20140126/200*150_52e4c1ecb4884.jpg' , where messageId = '20140126160640' 阅读全文
posted @ 2014-01-26 16:10 路在脚下, 阅读(122) 评论(0) 推荐(0) 编辑
摘要:发送: 1,选择上传的图片 》保存图片信息(上传之前,本地) 》上传图片到 应用服务器 》上传成功后发送图片信息到openfire服务器,同时修改图片信息(图片的网络地址,缩略地址), 2,进行录音 》录完后转码 》保存录音信息(本地) 》上传录音,成功后,发送音频信息(保存音频信息), 接收: 1 阅读全文
posted @ 2014-01-25 16:45 路在脚下, 阅读(310) 评论(0) 推荐(0) 编辑
摘要:[formData appendPartWithFileData:upImageDataname:@"file"fileName:@"d.jpg"mimeType:@""];,因为 name,上传这两个文件名都是有要求的, 阅读全文
posted @ 2014-01-25 15:52 路在脚下, 阅读(149) 评论(0) 推荐(0) 编辑
摘要:+ (NSString*)getPathByFileName:(NSString *)_fileName ofType:(NSString *)_type { NSString* fileDirectory = [[[VoiceRecorderBaseVCgetCacheDirectory]stri 阅读全文
posted @ 2014-01-24 14:34 路在脚下, 阅读(274) 评论(0) 推荐(0) 编辑
摘要:self.soundBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; 阅读全文
posted @ 2014-01-24 11:44 路在脚下, 阅读(104) 评论(0) 推荐(0) 编辑
摘要:#pragma mark - 播放原wav - (IBAction)playWav:(id)sender { UIButton *btn = (UIButton *)sender; playIndex = btn.tag; ChatMessageInfo *info = [self.dataArra 阅读全文
posted @ 2014-01-23 17:16 路在脚下, 阅读(539) 评论(0) 推荐(0) 编辑
摘要:-(void)updateSound{ NSIndexPath *_path = [NSIndexPathindexPathForItem:playIndexinSection:0]; IMVoiceCell *cell = (IMVoiceCell *)[self.tableViewcellForRowAtIndexPath:_path]; self.soundBtn = cell.soundBtn; TTLog(@".......................%d",self.soundBtn.tag); 阅读全文
posted @ 2014-01-23 17:15 路在脚下, 阅读(123) 评论(0) 推荐(0) 编辑
摘要:-(void)initVoiceModule{ //初始化录音vc self.recorderVC = [[ChatVoiceRecorderVCalloc]init]; self.recorderVC.vrbDelegate = self; //初始化播放器 self.player = [[AVAudioPlayer alloc]init]; //添加长按手势 UILongPressGestureRecognizer *longPrees = [[UILongPressGestureRecognizeralloc]initWithTarget:selfaction:@sel... 阅读全文
posted @ 2014-01-23 16:52 路在脚下, 阅读(254) 评论(0) 推荐(0) 编辑
摘要:#pragma mark - 播放原wav - (IBAction)playWav:(id)sender { UIButton *btn = (UIButton *)sender; ChatMessageInfo *info = [self.dataArray objectAtIndex:btn.t 阅读全文
posted @ 2014-01-23 13:52 路在脚下, 阅读(330) 评论(0) 推荐(0) 编辑
摘要:-(IBAction)initialTimer{ if (!soundTimer) { soundTimer = [NSTimerscheduledTimerWithTimeInterval:0.5ftarget:selfselector:@selector(testTimer) userInfo:Nilrepeats:YES]; } }-(IBAction)invalidate{ [soundTimersetFireDate:[NSDatedistantFuture]];// [soundTimer invalidate];}-(IBAction)restart{ [soun... 阅读全文
posted @ 2014-01-23 10:52 路在脚下, 阅读(161) 评论(0) 推荐(0) 编辑
摘要:CGSize timeSize = [self.timeLabel.textsizeWithFont:self.timeLabel.fontconstrainedToSize:CGSizeMake(MAXFLOAT, MAXFLOAT)];1, self.timeLabel.frame = CGRectMake(self.soundBtn.frame.origin.x - timeSize.width, self.timeLabel.frame.origin.y, timeSize.width, self.timeLabel.frame.size.height);2, self.... 阅读全文
posted @ 2014-01-22 11:32 路在脚下, 阅读(152) 评论(0) 推荐(0) 编辑
摘要:timer = [NSTimerscheduledTimerWithTimeInterval:0.1ftarget:selfselector:@selector(updateMeters) userInfo:nilrepeats:YES]; [recorderupdateMeters]; curCo 阅读全文
posted @ 2014-01-22 10:41 路在脚下, 阅读(159) 评论(0) 推荐(0) 编辑
摘要:NSString* fileDirectory = [[[VoiceRecorderBaseVCgetCacheDirectory]stringByAppendingPathComponent:_fileName]stringByAppendingPathExtension:_type];Printing description of self->tempFileName:/var/mobile/Applications/934C1545-332F-4732-AD19-D08E126534EC/Documents/20140121151438.wav(lldb) self.pl... 阅读全文
posted @ 2014-01-21 15:24 路在脚下, 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-01-21 13:15 路在脚下, 阅读(154) 评论(0) 推荐(0) 编辑
摘要:都是 给一个路径,然后 数据本身 有写入对应路径的方法, /** 生成文件路径 @param _fileName 文件名 @param _type 文件类型 @returns 文件路径 */ + (NSString*)getPathByFileName:(NSString *)_fileName o 阅读全文
posted @ 2014-01-20 17:09 路在脚下, 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-01-20 16:15 路在脚下, 阅读(118) 评论(0) 推荐(0) 编辑
摘要:1,先有文件名,然后给 这个路径 写入音频数据,这就算保存到本地了,self.recordFilePath = [VoiceRecorderBaseVCgetPathByFileName:recordFileNameofType:@"wav"]; self.recorder = [[[AVAudioRecorderalloc]initWithURL:[NSURLURLWithString:recordFilePath] settings:[VoiceRecorderBaseVC getAudioRecorderSettingDict] ... 阅读全文
posted @ 2014-01-20 10:32 路在脚下, 阅读(435) 评论(0) 推荐(0) 编辑
摘要:一、1、早喝盐水如参汤,晚喝盐水如砒霜。2、一日两苹果,毛病绕道过3、一日一枣,长生不老4、核桃山中宝,补肾又健脑5、铁不冶炼不成钢,人不养生不健康二、1、胡萝卜,小人参;经常吃,长精神2、西红柿,营养好,貌美年轻疾病少3、小小黄瓜是个宝,减肥美容少不了4、多吃芹菜不用问,降低血压很管用三、1、夏天一碗绿豆汤,解毒去暑赛仙方2、晨吃三片姜,如喝人参汤3、女子三日不断藕,男子三日不断姜4、萝卜出了地,郎中没生意5、吃了十月茄,饿死郎中爷四、1、三天不吃青,两眼冒金星2、宁可食无肉,不可饭无汤3、饭前喝汤,胜过药方4、吃面多喝汤,免得开药方5、早喝盐汤如参汤,晚喝盐汤如砒霜五、1、宁可锅中存放,不 阅读全文
posted @ 2014-01-20 09:39 路在脚下, 阅读(312) 评论(0) 推荐(0) 编辑
摘要:jsonkit里面, NSDictionary *JSON = [bodyStr objectFromJSONString]; 阅读全文
posted @ 2014-01-19 12:31 路在脚下, 阅读(145) 评论(0) 推荐(0) 编辑
摘要:中文名称卫辉市外文名称City of Weihui别名汲县行政区类别县级市所属地区中国华北下辖地区汲水镇城郊乡后河镇太公泉镇政府驻地汲水镇电话区号0373邮政区码453100地理位置河南省北部太行山东麓卫水之滨面积1亩=666.66666666667平方米10亩 = 6666平方米1平方米 = 2万100平方米 = 200万,6666平方米 =13 332 万882平方千米(平方公里)=1 323 000亩882平方公里一般种植行距3米,株距3米,种植以后到第三年隔一行伐一行,到第五年,再隔一棵伐一棵,剩下的树是行距6米,株距6米,到第十年全部伐掉。一般一亩地初植80株到100株,根据你的地形 阅读全文
posted @ 2014-01-17 16:24 路在脚下, 阅读(1186) 评论(0) 推荐(0) 编辑
摘要:iPhone,iPhone 3G:128MB内存, iPhone 3GS和iPad:256MB内存。 iPhone 4(4s):512MB内存,800MHZ, iPhone5s :1G内存 16Gb,的存储 网络模式:HSPA+,联通3G(WCDMA),联通2G... 网络类型:单卡双模 主屏尺寸: 阅读全文
posted @ 2014-01-17 15:30 路在脚下, 阅读(345) 评论(0) 推荐(0) 编辑
摘要:在连接域名发生错误的时候,这个方法需要很长时间才回调,- (void)xmppStreamDidDisconnect:(XMPPStream *)sender withError:(NSError *)error{ TTLog(@"%@",error);}xmppStreamDidDisconnect:withError:] [L172] Error Domain=NSPOSIXErrorDomain Code=60 "Operation timed out" UserInfo=0xd90a8d0 {NSLocalizedFailureReason=Er 阅读全文
posted @ 2014-01-17 10:37 路在脚下, 阅读(333) 评论(0) 推荐(0) 编辑
摘要:1,设定音量0.0~1.0[myPlayer setVolume:0.5];2,设定播放次数-1为无限循环[myPlayer setNumberOfLoops:0];3,设定播放位置(重头播放)[myPlayer setCurrentTime:0.0];4,播放[myPlayer play];5,暂停[myPlayer pause];6,停止[myPlayer stop];7,音乐总长度 [myPlayer duration]8,目前播放位置 [myPlayer currentTime]9,声道数目 [myPlayer numberOfChannels]10,向后跳转一秒NSTimeInter 阅读全文
posted @ 2014-01-16 15:58 路在脚下, 阅读(371) 评论(0) 推荐(0) 编辑
摘要:我如果爱你 绝不像攀援的凌霄花,借你的高枝炫耀自己;我如果爱你 绝不学痴情的鸟儿,为绿荫重复单调的歌曲;也不止像泉源,常年送来清凉的慰藉;也不止像险峰,增加你的 高度,衬托你的威仪。甚至日光,甚至春雨。不,这些还不够!我必须是你近旁的一株木棉,作为树的形象和你站在一起。根,紧握在地下,叶,相触在云里 阅读全文
posted @ 2014-01-15 18:11 路在脚下, 阅读(127) 评论(0) 推荐(0) 编辑
摘要:转:https://ismaple.com/blog/2012/02/26/osx-exp-share/ 原型图制作工具:axure rp pro, 26Feb 更新 2012-09-25 添加了新软件 更新 2012-11-22 添加新软件并重新归类 更新 2013-02-27 添加了些 web/ 阅读全文
posted @ 2014-01-15 16:18 路在脚下, 阅读(1244) 评论(0) 推荐(0) 编辑
摘要:http://www.baidu.com/link?url=E1j2UCRT2NATxi4ak4y86e7lgPlCgxAps9Eq50rLDWTbNWOoABESmbUEhydKKavDy7-pXXDN9cqFFL7PKsg1V_(转)1、nil和null从字面意思来理解比较简单,nil是一个对象,而NULL是一个值,我的理解为nil是将对象设置为空,而null是将基本类型设置为空的,个人感觉有点像属性当中,基本类型分配为assign NSString类型一般分配copy,而对象一般用retain。而且我们对于nil调用方法,不会产生crash或者抛出异常。看一段nil -> Null 阅读全文
posted @ 2014-01-15 15:58 路在脚下, 阅读(237) 评论(0) 推荐(0) 编辑
摘要:http://cvito.net/index.php/archives/869(雪印笔记)发表于2013 年 5 月 28 日由水德星君前文书咱们说到IOS下如何录制一个wav格式的音频,然而现在的情况确实安卓不支持wav格式,于是有看官说了,你个二百五,就不能选个安卓支持的格式录制么,我很负责任的说,苹果和谷歌掐架,苦的就是我们这帮苦逼的技术人员。。。安卓的格式苹果全不支持,看好是全不,不是全部,反过来苹果的格式,安卓也不惯着。。。。当然上有政策下有对策是万年不变的真理,Ios与安卓的音频互通是难不倒我们伟大的程序员的,而目前解决这个问题方案有很多种但大致以下3种方式,且听我细细道来。第一种 阅读全文
posted @ 2014-01-14 12:17 路在脚下, 阅读(1477) 评论(0) 推荐(0) 编辑
摘要:创建Timer的三种方法1.scheduling a timer with the current run loop 2.creating a timer that you later register with a run loop3.initializing a timer with a given fire dateScheduled Timers以下两个方法自动注册新创建的timer到当前NSRunLoop对象,NSRunLoop的模式为默认的NSDefaultRunLoopMode+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeI 阅读全文
posted @ 2014-01-14 10:58 路在脚下, 阅读(216) 评论(0) 推荐(0) 编辑
摘要:http://www.raywenderlich.com/259/audio-tutorial-for-ios-playing-audio-programatically 1,音频文件格式,音频容器 .caf: .mpeg-1: .mpeg-2: .adts: .aiff: .caf: .wave: 阅读全文
posted @ 2014-01-14 10:47 路在脚下, 阅读(581) 评论(0) 推荐(0) 编辑
摘要:1,初始化AVAudioSession//7.0第一次运行会提示,是否允许使用麦克风 AVAudioSession *session = [AVAudioSessionsharedInstance]; NSError *sessionError; //AVAudioSessionCategoryPlayAndRecord用于录音和播放 [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&sessionError]; if(session == nil) NSLog(@"Error... 阅读全文
posted @ 2014-01-13 18:37 路在脚下, 阅读(387) 评论(0) 推荐(0) 编辑
摘要:转:http://blog.csdn.net/ysy441088327/article/details/8164120(余书懿)音频方面的知识,相对其他编程还是较为复杂的,特别是要搞清楚框架里具体使用的参数和方法,不然写起代码来非常迷茫.1:播放简短性质的音频,例如按键声音,等可以这样实现.一:引入框架:[csharp]view plaincopy#import二:先声明一个声音源ID[csharp]view plaincopySystemSoundID_bookSoundID;三:提供需要播放的音频地址进行声音源的注册.[csharp]view plaincopyNSURL*bookSoun 阅读全文
posted @ 2014-01-13 17:30 路在脚下, 阅读(1015) 评论(1) 推荐(0) 编辑
摘要:http://www.pipetips.com/entries/2012/11/22/11711.html(转)SIP vs XMPP (Jabber)SIP and XMPP are application layer protocols mostly used to send voice or IM over Internet. SIP is defined by RFC 3621 and XMPP is defined in RFC 3920. Basically XMPP is evolved from IM and Presence, whereas SIP evolved from 阅读全文
posted @ 2014-01-13 15:45 路在脚下, 阅读(385) 评论(0) 推荐(0) 编辑
摘要:VoIP(Voice over Internet Protocol)简而言之就是将模拟信号(Voice)数字化,以数据封包(Data Packet)的形式在IP网络(IP Network)上做实时传递。VoIP的基本原理是通过语音的压缩算法对语音数据编码进行压缩处理,然后把这些语音数据按 TCP/IP 标准进行打包,经过 IP 网络把数据包送至接收地,再把这些语音数据包串起来,经过解压处理后,恢复成原来的语音信号,从而达到由互联网传送语音的目的。 IP 电话的核心与关键设备是 IP 网关,它把各地区电话区号映射为相应的地区网关 IP 地址。这些信息存放在一个数据库中,数据接续处理软件将完成呼叫 阅读全文
posted @ 2014-01-13 15:12 路在脚下, 阅读(174) 评论(0) 推荐(0) 编辑
摘要:转:http://blog.csdn.net/kylinbl/article/details/8965074(KylinBL的专栏)最近在使用xmppframwork来实现一个聊天应用,碰到了一个问题,应用进入后台以后,就接收不到消息了;怎么样才能使应用被切到后台时,应用中的网络连接仍然接收数据并维持存活(像QQ iphone 一样),下面一步一步来分析。针对iOS应用的状态,存在以下三种情况:1)若iOS应用为活动状态,刚与服务器保持一个长连接,客户端与服务器通过此连接收发消息。2)若iOS应用为退出状态,长连接被断开,服务器向客户端发消息则通过APNS推送消息实现。3)若iOS应用刚刚切至 阅读全文
posted @ 2014-01-13 14:45 路在脚下, 阅读(1045) 评论(0) 推荐(0) 编辑
摘要:1,-(XMPPMessage *)sendMessage:(NSString *)newMessage andJID:(XMPPJID *)jid{ NSXMLElement *body = [NSXMLElementelementWithName:@"body"]; [body setStringValue:newMessage]; XMPPMessage *message = [XMPPMessageelementWithName:@"message"]; [message addAttributeWithName:@"type" 阅读全文
posted @ 2014-01-13 09:45 路在脚下, 阅读(402) 评论(0) 推荐(0) 编辑
摘要:1, [xmppStreamaddDelegate:selfdelegateQueue:dispatch_get_main_queue()];2, im_queue = dispatch_queue_create("im.queue", Nil); [xmppStreamaddDelegate:selfdelegateQueue:im_queue];3,- (XMPPMessage *)xmppStream:(XMPPStream *)sender willSendMessage:(XMPPMessage *)message{ TTLog(@"%@",m 阅读全文
posted @ 2014-01-12 18:03 路在脚下, 阅读(194) 评论(0) 推荐(0) 编辑
摘要:1,nsfilemanager:对文件的管理,增删改查2, 沙盒:就一个目录结构,其它资源文件都是基于这个,3,mainbundle:主要是 对存放资源的查找,不清楚 与nsfilemanager的查找 有神马区别,从范围上,从数量上,NSFileManagerNSHomeDirectoryNSBundle文件相关, 阅读全文
posted @ 2014-01-12 16:05 路在脚下, 阅读(155) 评论(0) 推荐(0) 编辑
摘要:转:http://www.cocoachina.com/bbs/read.php?tid=9640bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像,声音,编译好的代码,nib文件(用户也会把bundle称为plug-in). 对应bundle,cocoa提供了类NSBundle.我们的程序是一个bundle. 在Finder中,一个应用程序看上去和其他文件没有什么区别. 但是实际上它是一个包含了nib文件,编译代码,以及其他资源的目录. 我们把这个目录叫做程序的main bundlebundle中的有些资源可以本地化.例如,对于foo.nib,我们可以有两个版本: 阅读全文
posted @ 2014-01-12 15:56 路在脚下, 阅读(272) 评论(0) 推荐(0) 编辑
摘要:找图片, 阅读全文
posted @ 2014-01-12 15:40 路在脚下, 阅读(126) 评论(0) 推荐(0) 编辑
摘要:转:http://blog.csdn.net/totogo2010/《容芳志专栏》1、iOS沙盒机制iOS应用程序只能在为该改程序创建的文件系统中读取文件,不可以去其它地方访问,此区域被成为沙盒,所以所有的非代码文件都要保存在此,例如图像,图标,声音,映像,属性列表,文本文件等。1.1、每个应用程序都有自己的存储空间1.2、应用程序不能翻过自己的围墙去访问别的存储空间的内容1.3、应用程序请求的数据都要通过权限检测,假如不符合条件的话,不会被放行。 通过这张图只能从表层上理解sandbox是一种安全体系,应用程序的所有操作都要通过这个体系来执行,其中核心内容是:sandbox对应用程序执行各. 阅读全文
posted @ 2014-01-12 15:21 路在脚下, 阅读(170) 评论(0) 推荐(0) 编辑
摘要:第一次见 回调过程发生在 两行代码之间,而不是两个分离的方法,//发送信息-(XMPPMessage *)sendMessage:(NSString *)mess andJID:(XMPPJID *)jid{ NSXMLElement *body = [NSXMLElementelementWithName:@"body"]; [body setStringValue:mess]; XMPPMessage *message = [XMPPMessageelementWithName:@"message"]; [message addAttributeWi 阅读全文
posted @ 2014-01-10 16:21 路在脚下, 阅读(299) 评论(0) 推荐(0) 编辑
摘要:XMPPElementReceipt *receipt = [XMPPElementReceiptnew];// * - Do an instantaneous check (pass timeout == 0)// * - Wait until the element has been sent (pass timeout 0) [mStream sendElement:message andGetReceipt:&receipt]; [receipt wait:-1];// * If you later want to check to see if the element ... 阅读全文
posted @ 2014-01-10 16:07 路在脚下, 阅读(196) 评论(0) 推荐(0) 编辑
摘要:#pragma mark -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////@interface XMPPElementReceipt : NSObject{uint32_t atomicFlags;dispatch_semaphore_t semaphore;}/*** Element receipts allow you to check to see if the element has been 阅读全文
posted @ 2014-01-10 15:54 路在脚下, 阅读(268) 评论(0) 推荐(0) 编辑
摘要:Hello Tigase Team,I wonder Is there any good way the confirm the successful delivery of a message to the recipient?For example, the Facebook Messenger has status for each (last) message as "Delivered" and "Read", which is pretty usefulto confirm that a message is received, and/or 阅读全文
posted @ 2014-01-10 15:01 路在脚下, 阅读(196) 评论(0) 推荐(0) 编辑
摘要:和著名的统计工具Google Analytics相比,Flurry的优点是:Flurry专门针对移动端做了许多优化,例如统计流量就小很多。Flurry没有被墙的问题。Flurry缺点是:Google Analytics的统计功能相对更强大一些。Google Analytics可以和网页版的统计数据做整合。和国内的分析平台友盟相比,Flurry的优点是:使用Flurry的应用相对更多。根据Flurry和友盟的官方数据,有超过36万应用使用Flurry1,有超过18万应用使用友盟2。Flurry是国外的公司,保持独立和专注,数据安全性更高;友盟现在已经被阿里收购,当用户的应用涉及领域和阿里有类似或 阅读全文
posted @ 2014-01-10 13:35 路在脚下, 阅读(282) 评论(0) 推荐(0) 编辑
摘要:上半拉 是 客户端请求,下半拉 是响应,去Charles的官方网站(http://www.charlesproxy.com)下载最新版的Charles安装包,是一个dmg后缀的文件。打开后将Charles拖到Application目录 下即完成安装。如果你需要截取分析SSL协议相关的内容。那么需要安装Charles的CA证书。具体步骤如下:去http://www.charlesproxy.com/ssl.zip下载CA证书文件。map remote,editrepeat, 阅读全文
posted @ 2014-01-10 11:43 路在脚下, 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-01-10 10:49 路在脚下, 阅读(489) 评论(0) 推荐(0) 编辑
摘要:查看图片,查看变量, 阅读全文
posted @ 2014-01-10 10:27 路在脚下, 阅读(103) 评论(0) 推荐(0) 编辑
摘要:Share Data AmongAppsiOS provides powerful connectivity options for sharing information among the applications installed on a device. Using a URL-based syntax, you can access data from the Web, as well as pass information to other installed applications, such as Mail, iTunes, and YouTube. Your own ap 阅读全文
posted @ 2014-01-09 18:08 路在脚下, 阅读(136) 评论(0) 推荐(0) 编辑
摘要:iGoogle有话说:应用程序框架主线程已经封装了对NSRunLoop runMode:beforeDate:的调用;它和while循环构成了一个消息泵,不断获取和处理消息;可能大家会比较奇怪,既然主线程中已经封装好了对NSRunLoop的调用,为什么这里还可以再次调用,这个就是它与Windows消息循环的区别,它可以嵌套调用.当再次调用while+NSRunLoop时候程序并没有停止执行,它还在不停提取消息/处理消息.这一点与Symbian中Active Scheduler的嵌套调用达到同步作用原理是一样的.]2.RunLoop和线程的关系:1.主线程的runloop默认是启动的,用于接收各 阅读全文
posted @ 2014-01-09 16:40 路在脚下, 阅读(336) 评论(0) 推荐(0) 编辑
摘要:这个只是传递了主线程 [xmppStreamaddDelegate:selfdelegateQueue:dispatch_get_main_queue()];而具体网络请求放入主线程没有,还要 看具体执行的代码,比如,dispatch_async,dispatch_after,模式:1,NSError *error;if ([mStream connect:&error])2,XMPPElementReceipt *receipt = Nil; [mStream sendElement:message andGetReceipt:&receipt]; 阅读全文
posted @ 2014-01-09 15:12 路在脚下, 阅读(148) 评论(0) 推荐(0) 编辑
摘要:转:http://blog.csdn.net/dxpqxb/article/details/7987764(好记性不如写博客!)你来修改,我来修改,后来就 改的不成样子了,因此就不安全了, 规则规定,你想改可以,但是要通知 主线程,我们经常看见一句话:Android主线程是线程不安全的。这句话的意思是:更新UI只能是主线程的工作,子线程更新UI是线程不安全的,所以android里非主线程操作主UI就会报错。为什么呢?因为子线程可能会有多个,多个线程同时操作一个控件可能会有冲突发生,所以android就限定了只有主线程可以操作UI。子线程想操作UI,可以,你告诉我(主线程),我来更新。 在一个A 阅读全文
posted @ 2014-01-09 12:05 路在脚下, 阅读(449) 评论(0) 推荐(0) 编辑
摘要:转:http://tangqiaoboy.blog.163.com/blog/static/1161142582011873458953/主道路,人行道,不要占用资源,在单机的多线程程序里,为了保证UI的操作线程安全,都会要求UI的操作在一个特定的线程里面进行,通常情况下,这个特定线程指的是程序的主线程。所以,当你的代码在主线程运行的时候,实际上会造成UI不能重绘,应该尽量把长时间的操作放到非主线程中去。 对于在iphone里的app也一样应该遵守上面这个原则。不过iphone的 UIWebView的stringByEvaluatingJavaScriptFromString只能在主线程里面被 阅读全文
posted @ 2014-01-09 11:42 路在脚下, 阅读(798) 评论(0) 推荐(0) 编辑
摘要:-(void)doInitialWork{ mStream = [[XMPPStreamalloc]init]; dispatch_queue_t im_queue; im_queue = dispatch_queue_create("im.queue", Nil); [mStreamaddDelegate:selfdelegateQueue:im_queue]; dispatch_block_t b = ^{ TTLog(@"aa"); };同步,不同步,是任务安装添加的顺序执行而已,还是顺序执行的,同步的话,第一个执行完了,第二个才执行,而不同步的话 阅读全文
posted @ 2014-01-09 10:58 路在脚下, 阅读(232) 评论(0) 推荐(0) 编辑
摘要:转:http://www.cnblogs.com/qingche/p/3496190.html(清澈Saup)1.iOS的三种多线程技术 1.NSThread每个NSThread对象对应一个线程,量级较轻(真正的多线程)2.以下两点是苹果专门开发的“并发”技术,使得程序员可以不再去关心线程的具体使用问题ØNSOperation/NSOperationQueue面向对象的线程技术ØGCD —— Grand Central Dispatch(派发) 是基于C语言的框架,可以充分利用多核,是苹果推荐使用的多线程技术哦,原来有三种 线程 技术啊,哦,原来是这样,以... 阅读全文
posted @ 2014-01-09 10:25 路在脚下, 阅读(203) 评论(0) 推荐(0) 编辑
摘要:Example 3. A content message with receipt requested My lord, dispatch; read o'er these articles. Note: A sender MUST include an 'id' attribute on every content message that requests a receipt, so that the sender can properly track ack messages. 阅读全文
posted @ 2014-01-08 17:02 路在脚下, 阅读(154) 评论(0) 推荐(0) 编辑
摘要:1,声明 创建一个队列dispatch_queue_tnetwork_queue; network_queue=dispatch_queue_create("com.myapp.network",nill); 2,异步并行 执行(队列 + 要执行的代码)dispatch_async(network_queue, ^{ UIImage *cellImage = [self loadMyImageFromNetwork:image_url]; // 将图片cache到本地 [self cacheImage:cellImage]; ..... } );3,执行完,... 阅读全文
posted @ 2014-01-08 16:09 路在脚下, 阅读(276) 评论(0) 推荐(0) 编辑
摘要:转自anxonli:http://anxonli.iteye.com/blog/1097777这次的文章集中与iOS的多核编程和内存管理,为什么?因为iPad 2已经是双核CPU了!虽然iPad 1的应用已经不慢了,但大家完全可以使用苹果的多核编程框架来写出更加responsive的应用。多核运算在iOS中concurrency编程的框架就是GCD(Grand Central Dispatch), GCD的使用非常简单。它把任务分派到不同的queue队列来处理。开发者把任务代码装到一个个block里面,操作系统把这些任务代码分派到不同的资源里去处理,一个简单的例子来说,为什么初学者写table 阅读全文
posted @ 2014-01-08 15:51 路在脚下, 阅读(189) 评论(0) 推荐(0) 编辑
摘要:/*** Just like the sendElement: method above,* but allows you to receive a receipt that can later be used to verify the element has been sent.** If you later want to check to see if the element has been sent:** if ([receipt wait:0]) {* // Element has been sent* }** If you later want to wait until t. 阅读全文
posted @ 2014-01-08 12:09 路在脚下, 阅读(324) 评论(0) 推荐(0) 编辑
摘要:肺都切除了,还让怎样呼吸,//下线- (void)goOffline{ XMPPPresence *presence = [XMPPPresencepresenceWithType:@"unavailable"]; [mStream sendElement:presence];// [mStream removeDelegate:self];[mStreamdisconnect];} 阅读全文
posted @ 2014-01-08 11:21 路在脚下, 阅读(129) 评论(0) 推荐(0) 编辑
摘要:select *from instantMessage where ownerId = 1 orderby sendDate asclimit 10 offset 0 阅读全文
posted @ 2014-01-07 16:21 路在脚下, 阅读(140) 评论(0) 推荐(0) 编辑
摘要:-(NSArray *)sortArrayByComparator:(NSArray *)arr{ return [arr sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { ChatMessageInfo *info1 = obj1; ChatMessageInfo *info2 = obj2; if (info1.sendDate > info2.sendDate) { returnNSOrderedDescending; }else if(info1.sendDate < ... 阅读全文
posted @ 2014-01-07 16:17 路在脚下, 阅读(239) 评论(0) 推荐(0) 编辑
摘要:#pragma main switch-(IBAction)mainSwitch:(NSNotification *)notification{ switch (frameState) { case allShow: { [self showFaceViewFrameHandler:notification]; [self showUpperViewFrameHandler:notification]; [self showTableViewFrameHandler:notification]; [selftextViewDidChange... 阅读全文
posted @ 2014-01-07 10:12 路在脚下, 阅读(141) 评论(0) 推荐(0) 编辑
摘要:tableview 的contentoffset自己变化了,变小了,也可以理解为 contentinset的bottom 变化了,不知道为什么, 阅读全文
posted @ 2014-01-07 10:04 路在脚下, 阅读(131) 评论(0) 推荐(0) 编辑
摘要:bottomView.frame = CGRectMake(bottomView.frame.origin.x, self.contentView.frame.size.height - keyboardHeight - kContentSize.height - textViewBgAndCursor*2, bottomView.frame.size.width, kContentSize.height + textViewBgAndCursor * 2);所有的相关属性 都不是自己调用自己,因此,不会出现 a - 3 - 5, 阅读全文
posted @ 2014-01-06 18:17 路在脚下, 阅读(97) 评论(0) 推荐(0) 编辑
摘要:frameState = allShow; [bottomView.inputTextViewbecomeFirstResponder]; [bottomView.inputTextViewbecomeFirstResponder]; frameState=allShow; 阅读全文
posted @ 2014-01-06 16:50 路在脚下, 阅读(101) 评论(0) 推荐(0) 编辑
摘要:多次 设置frame,并用了动画, [UIViewbeginAnimations:nilcontext:nil]; [UIViewsetAnimationDelegate:self]; [UIViewsetAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]]; [UIViewsetAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurat... 阅读全文
posted @ 2014-01-06 15:44 路在脚下, 阅读(124) 评论(0) 推荐(0) 编辑
摘要:self.tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; bottomView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin; 阅读全文
posted @ 2014-01-06 15:34 路在脚下, 阅读(150) 评论(0) 推荐(0) 编辑
摘要:要么xib,要么代码, 阅读全文
posted @ 2014-01-06 12:31 路在脚下, 阅读(114) 评论(0) 推荐(0) 编辑
摘要:用了 window.frame.size.height,这个对于两个版本(ios7以及ios7以下的)来说是不同的,ios7里面是包括了statusbar的,而后者没有包括, message detail,self.inputView.frame = CGRectMake(self.inputView.frame.origin.x, SharedAppDelegate.window.frame.size.height - self.faceInputView.frame.size.height - contentSize.height - 5 , self.inputView.fra... 阅读全文
posted @ 2014-01-06 11:09 路在脚下, 阅读(181) 评论(0) 推荐(0) 编辑
摘要:为什么那个地方没有找呢,这么显眼的一个地方,保持讨论, 阅读全文
posted @ 2014-01-04 17:30 路在脚下, 阅读(150) 评论(0) 推荐(0) 编辑
摘要:2014-01-04 16:16:12.537 Zhaocailing[9118:a0b] -[IMRootManager xmppStreamDidDisconnect:withError:] [L118] Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo=0xc1f5c70 {NSLocalizedFailureReason=Error in connect() function, NSLocalizedDescription=Connection refused} 阅读全文
posted @ 2014-01-04 16:18 路在脚下, 阅读(191) 评论(0) 推荐(0) 编辑
摘要:#import "IMKChattingViewController.h"#import "IMCelebrityCell.h"#import "IMChatCell.h"#import "IMBottomView.h"#import "UIImageView+WebCache.h"#import "IMBuyView.h"#define naviHeight 44#define kBottomViewHeightDefault 43#define keyboardShow 阅读全文
posted @ 2014-01-04 12:21 路在脚下, 阅读(266) 评论(0) 推荐(0) 编辑
摘要:NSData *logoImageData = [logoDataArr objectAtIndex:0]; [formData appendPartWithFileData:logoImageData name:@"pic03"fileName:@"d.jpg"mimeType:@""]; NSData *imageData = [imageDataArr objectAtIndex:0]; [formData appendPartWithFileData:imageData name:@"pic"fileNam 阅读全文
posted @ 2014-01-03 15:55 路在脚下, 阅读(255) 评论(0) 推荐(0) 编辑
摘要:1,- (void)viewDidLoad2,veiwwillappear,一个写数据加载,一个写界面frame的调整 阅读全文
posted @ 2014-01-03 14:20 路在脚下, 阅读(143) 评论(0) 推荐(0) 编辑
摘要:bottomView.frame = CGRectMake(bottomView.frame.origin.x, self.contentView.frame.size.height - keyboardHeight - contentSize.height - textViewBgAndCursor*2, bottomView.frame.size.width, contentSize.height + textViewBgAndCursor * 2);#define textViewCursorToTop 1#define textViewHeightLimit 6#define tex. 阅读全文
posted @ 2014-01-02 16:34 路在脚下, 阅读(106) 评论(0) 推荐(0) 编辑
摘要:第一种成了自调用了, bottomView.frame = CGRectMake(bottomView.frame.origin.x, bottomView.frame.origin.y - contentSize.height, bottomView.frame.size.width, bottomView.frame.size.height + contentSize.height); self.inputView.frame = CGRectMake(self.inputView.frame.origin.x, self.view.frame.size.height - conten.. 阅读全文
posted @ 2014-01-02 14:22 路在脚下, 阅读(107) 评论(0) 推荐(0) 编辑
摘要:- (void)keyboardWillHide:(NSNotification*)notification { [UIViewbeginAnimations:nilcontext:nil]; [UIViewsetAnimationDelegate:self]; [UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIViewsetAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey]... 阅读全文
posted @ 2014-01-02 12:21 路在脚下, 阅读(221) 评论(0) 推荐(0) 编辑
摘要:- (void)viewDidLoad{ [superviewDidLoad]; [self initData]; }-(void)viewWillAppear:(BOOL)animated{ [selfinitBottomView];} 阅读全文
posted @ 2014-01-02 11:11 路在脚下, 阅读(227) 评论(0) 推荐(0) 编辑
摘要:42---44, 阅读全文
posted @ 2014-01-02 09:57 路在脚下, 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-01-02 09:46 路在脚下, 阅读(82) 评论(0) 推荐(0) 编辑
摘要:第一章 心理影响实验1:插队一个心理学家跑到图书馆,请排队等候复印的人帮她一个小忙。"对不起,我有5页纸要复印,能不能让我先复印呢?"当她这样说时,60%的人答应了。然后,她换了一种说法:"对不起,能不能让我先复印呢?因为我要复印几页纸。"她只多加了两个字"因为",但同意的人居然增加到了93%。虽然心理学家早就知道,当我们请别人帮忙时,如果能够讲出一个理由,得到帮助的可能性就更大。但是这个实验证明,只是听到"因为"两个字,人们就会认为她是有理由的,从而给予帮助。这证明了人类存在心理定势,会不自觉地受到影响。提出请求 阅读全文
posted @ 2014-01-01 15:21 路在脚下, 阅读(170) 评论(0) 推荐(0) 编辑