摘要: 昨天搞了一天的GZip压缩,试了三种方式(libz库,ZipArchive,ASIHttpRequest),一开始都不成功。理论上三个应该都能用的,但我都不行。等我试到第三种方式的时候才知道,不是我的问题,而是后台的问题(Java端输出方式一会再说)。今天就总结一下,写写iOS与Java服务器获取压缩数据的方法吧。一、客户端-服务端数据压缩解压流程(ASIHttpRequest)客户端生成request,设置header允许使用压缩("Accept-Encoding","gzip"),即是告诉服务器,客户端支持压缩,但凡可以压缩的服务器,尽管来吧!服务器 阅读全文
posted @ 2012-08-20 09:43 Lawerence 阅读(1331) 评论(0) 推荐(0) 编辑
摘要: 1.处理textView的return事件- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ if (1 == range.length) { //空格 return YES; } if ([text isEqualToString:@"\n"]) { //return [textView resignFirstResponder]; return NO; } return NO;} 阅读全文
posted @ 2012-07-27 17:29 Lawerence 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1.当进入页面有大量数据要实时处理的时候(如处理网络数据,解析数据等),把需要处理的部分放在viewDidAppear中,然后加上等待动画,这样用户体验会好些!同样,加载大量数据的时候,在init中执行。 2.重写Pplaceholder的draw方法就可以了- (void) drawPlaceho 阅读全文
posted @ 2012-07-27 17:27 Lawerence 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Step 1: Create cert request file。(当你在apple web site "provisioning portal"里生成"Development Certificate" 和 "Push SSL Certificate"时就会用到它)1. Access "keychain access" by selecting "Application > Utilities > keychain access"2. select menu "keycha 阅读全文
posted @ 2012-07-18 16:42 Lawerence 阅读(1878) 评论(1) 推荐(0) 编辑
摘要: - (void)updateMemberPins{ [map addAnnotations:locationArray]; if ([locationArray count] > 0) { CLLocationCoordinate2D topLeftCoord; topLeftCoord.latitude = -90; topLeftCoord.longitude = 180; CLLocationCoordinate2D bottomRightCoord; bottomRightCoor... 阅读全文
posted @ 2012-06-18 18:12 Lawerence 阅读(191) 评论(0) 推荐(0) 编辑
摘要: useful commands for Mac / iOS:(this will be updated if i find new useful command)show the hidden files in Mac: defaults write com.apple.finder AppleShowAllFiles YESshow the Library file in Mac: chflags nohidden ~/library/重新指定:sudo xcode-select -switch /Applications/Xcode.app/调度技巧调度技巧一:程序在崩溃的时候,xcod. 阅读全文
posted @ 2012-06-14 13:56 Lawerence 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 第一次使用git,开始的时候每次都用命令行pull,add,commit,push的,后来使用github图形界面管理本地代码,但是每次都要输入ssh,很是麻烦。程序员生来就为解决问题的吧,于是耗时半天解决。常用的linux命令:http://linux.chinaitlab.com/special/linuxcom/reference: http://www.adminschoice.com/how-to-configure-ssh-without-passwordhttp://fclose.com/b/linux/366/set-up-git-server-through-ssh-conn 阅读全文
posted @ 2012-06-14 13:44 Lawerence 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 调试webService的接口,采用的soap协议,一直遇到一个问题,ErroeCode:415 unsupported media type,对于整个问题纠结了好久,一开始服务器有问题,改好后,请求还是出错。今天在网上找到如下的一段文字(见参考连接1),在加上一牛人的推荐的soapUI的工具,通过裸发soap报文,找到了问题的所在。soap 1.1拚出的Http request中的是xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"而soap1.2,则是xmlns:soap="http://www.w3. 阅读全文
posted @ 2012-06-04 19:24 Lawerence 阅读(446) 评论(0) 推荐(0) 编辑
摘要: UIView *customView;UIWindow *window = [[[UIApplication sharedApplication] keyWindow] addSubview:customView];in the ViewController:shouldAutorotateToInterfaceOrientation switch (interfaceOrientation) { case UIInterfaceOrientationLandscapeLeft: customView.transform = CGAffineTransf... 阅读全文
posted @ 2012-06-04 19:22 Lawerence 阅读(458) 评论(0) 推荐(0) 编辑