随笔分类 -  iOS笔记

摘要:http://blog.csdn.net/ydj213/article/details/8190220 阅读全文
posted @ 2013-01-07 14:32 Story Of My Life 阅读(132) 评论(0) 推荐(0) 编辑
摘要:URL请求一般分为同步和异步两种,请求是需要耗时的,所以肯定不能放在主线程中进行,这样会阻塞UI,这两种请求方式都可以在其他线程使用1、同步方式通过GCD来放到其他线程中执行dispatch_queue_t dispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);dispatch_async(dispatchQueue, ^(void) { NSURL *url = [NSURL URLWithString:urlAsString]; NSURLRequest *urlRequest = [.. 阅读全文
posted @ 2012-12-28 16:08 Story Of My Life 阅读(166) 评论(0) 推荐(0) 编辑
摘要:有时候界面上的按钮显示的是英文,比如搜索中的取消按钮,相机内的保存取消按钮等等,那么如何变成中文呢?开始想的是从程序中获取该按钮,然后修改其title。后来发现不用这么笨,直接在Project中Info下的Localization中将本地化设置为Chinese即可。 阅读全文
posted @ 2012-12-25 23:43 Story Of My Life 阅读(166) 评论(0) 推荐(0) 编辑
摘要:1、通过在textView中键盘上方添加一个toolBar来实现取消键盘的功能,可以添加其他功能:1 UIToolbar * topView = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 30)]; 2 [topView setBarStyle:UIBarStyleBlackTranslucent];3 4 UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSyste... 阅读全文
posted @ 2012-12-23 22:28 Story Of My Life 阅读(1405) 评论(0) 推荐(0) 编辑
摘要:让程序回到主线程的方法有:1、通过GCD返回主线程dispatch_async(dispatch_get_main_queue(), ^{ //code here }); 2、利用方法- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait 阅读全文
posted @ 2012-12-22 17:00 Story Of My Life 阅读(93) 评论(0) 推荐(0) 编辑
摘要:1、UIManagedDocument-(void)saveToURL:(NSURL *)url forSaveOperation:(UIDocumentSaveOperation)saveOperation completionHandler:(void (^)(BOOL success))completionHandler-(void)openWithCompletionHandler:(void (^)(BOOL success))completionHandleropen和save方法都是异步的asynchronous,所以其需要一个completionBlock来执行open或sav 阅读全文
posted @ 2012-12-21 17:06 Story Of My Life 阅读(235) 评论(0) 推荐(0) 编辑
摘要:http://www.cnblogs.com/yingkong1987/default.html?OnlyTitle=1 阅读全文
posted @ 2012-12-19 15:55 Story Of My Life 阅读(113) 评论(0) 推荐(0) 编辑
摘要:转载一篇关于view animation的文章http://blog.csdn.net/nerohoop/article/details/7245909补充:当启用animation来改变值的时候,值是立刻就改变了的,然后才开始动画。 阅读全文
posted @ 2012-12-18 20:08 Story Of My Life 阅读(133) 评论(0) 推荐(0) 编辑
摘要:这段时间在想如何通过segmentedControl来切换view,搜到好多办法,大多都是直接addSubview好几个view,然后在segmentValueChanged中对不需要显示的view进行隐藏[view setHidden:YES];或者是直接从superView删除[view removeFromSuperView];最后终于找到也许是最官方的做法,利用Container View Controller。Implementing a Custom Container View ControllerOnce you’ve designed your class’s behavio 阅读全文
posted @ 2012-12-18 19:00 Story Of My Life 阅读(1523) 评论(0) 推荐(0) 编辑
摘要:1. 没有连接segue的独立viewController,可以利用其中的StoryBoard ID来在程序中与其他视图连接UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"StoryBoard ID"];2. segue除了push、modal、popover以外,还可以自定义segue新view的出现方式,可以通过新建一个UIStoryBoardSegue的子类,然后重写perform方法来实现。 阅读全文
posted @ 2012-12-18 12:22 Story Of My Life 阅读(205) 评论(0) 推荐(0) 编辑