摘要: #import"GTMBase64.h"//utf-7 需要用到GTMBase64- (NSString *)stringFromUTF7String:(NSString *)utf7String{ NSMutableString *result = [NSMutableString string]; NSInteger location = 0; NSInteger len = 0; BOOL isBase64 = NO; for (int i = 0; i < utf7String.length; i++) { unichar ch = [utf7String c 阅读全文
posted @ 2012-08-29 17:13 翛尧 阅读(2053) 评论(0) 推荐(0)
摘要: 1+ (AFTwitterAPIClient *)sharedClient { static AFTwitterAPIClient *_sharedClient = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _sharedClient = [[AFTwitterAPIClientalloc] initWithBaseURL:[NSURLURLWithString:kAFTwitterAPIBaseURLString]]; }); return _sharedClient;}2stat... 阅读全文
posted @ 2012-08-15 10:13 翛尧 阅读(218) 评论(0) 推荐(0)
摘要: -initWithNibName:bundle: 里面不要执行内容。 阅读全文
posted @ 2012-08-13 16:27 翛尧 阅读(193) 评论(0) 推荐(0)
摘要: 有些时候我们想让UIButton的title居左对齐,我们设置btn.textLabel.textAlignment = UITextAlignmentLeft是没有作用的,我们需要设置btn.contentHorizontalAlignment = UIControlContentHorizonAlignmentLeft;但是问题又出来,此时文字会紧贴到做边框,我们可以设置btn.contentEdgeInsets = UIEdgeInsetsMake(0,10,0,0);使文字距离做边框保持10个像素的距离。 阅读全文
posted @ 2012-07-31 11:20 翛尧 阅读(303) 评论(0) 推荐(0)
摘要: 下载文件之前获得文件大小[m_pASIHTTPRequest setDidReceiveResponseHeadersSelector:@selector(didReceiveResponseHeaders:)];- (void)didReceiveResponseHeaders:(ASIHTTPRequest *)request{NSLog(@"didReceiveResponseHeaders %@",[m_request.responseHeaders valueForKey:@"Content-Length"]);} 阅读全文
posted @ 2012-07-31 10:47 翛尧 阅读(137) 评论(0) 推荐(0)
摘要: 在Info.plist里添加一行配置信息即可设置Application supports iTunes file sharing为YES.以下是返回该目录下文件路径的代码:-(NSString*)shareFilePath:(NSString*)filePath {NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);NSString *documentsDirectory = [paths objectAtIndex:0];return [documents 阅读全文
posted @ 2012-05-21 16:48 翛尧 阅读(527) 评论(0) 推荐(0)
摘要: UIScrollView的一些特点是个麻烦的控件,这里先问几个问题:1. 如果我触摸一下屏幕,哪个view会最先收到触摸消息呢(touchesBegan)?答案是,如果所有view都是UIView的话,那么最外层的子view会先收到该消息。这个机制就是通过UIView中的hitTest:withEvent: 实现的。也就是说底层的父view的hitTest函数先被调用,在这里遍历调用subView的hitTest,直到找到最外层的subView,然后返回该view,系统再把touch事件传给这个view。2.tableView的cell我点击一下,打开一个新页面,但如果飞快的swipe一下,t 阅读全文
posted @ 2012-05-17 17:58 翛尧 阅读(1013) 评论(0) 推荐(0)
摘要: iPhone应用程序 了解Locate定位技术是本文要介绍的内容,其实使用iphone的定位系统开发软件是很简单的一件事,下面我们就来认识一下iphone的定位系统的使用。1、Getting the User’s Current Location获取用户当前位置。获取位置的方式有三种:GPS, cell tower triangulation(蜂窝站点), 和 Wi-Fi Positioning Service (WPS).其中GPS是最精确的定位方式,但是在第一代iphone上没有。GPS是通过读取很多卫星微波信号来确定当前位置的。蜂窝站点通过 iphone周围的站点计算出来的,在蜂窝站点密 阅读全文
posted @ 2012-05-11 23:07 翛尧 阅读(402) 评论(0) 推荐(0)
摘要: MapKit学习笔记1、概述插入MapView,设置Delegate(一般为Controller),Annotations记录兴趣位置点(AnnotationView用来显示兴趣位置点),annotation是可选的,选中的annotation会显示callout,用来显示信息。2、设置地图显示类型:mapView.mapType = MKMapTypeStandard;mapView.mapType = MKMapTypeSatellite;mapView.mapType = MKMapTypeHybrid;3、显示用户位置设置为可以显示用户位置:mapView.showsUserLocat 阅读全文
posted @ 2012-04-23 16:23 翛尧 阅读(809) 评论(0) 推荐(0)
摘要: 1 NSString* timeStr = @"2011-01-26 17:40:50"; 2 NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 3 [formatter setDateStyle:NSDateFormatterMediumStyle]; 4 [formatter setTimeStyle:NSDateFormatterShortStyle]; 5 [formatter setDateFormat:@"YYYY-MM-dd HH:m... 阅读全文
posted @ 2012-03-18 21:36 翛尧 阅读(1549) 评论(0) 推荐(0)