- 博客(50)
- 资源 (10)
- 收藏
- 关注
原创 一个iOS RSS阅读器的分析
1.问:在一个tabBar,Navigation都具备的应用里,设置当前视图控制器的title,可以同时作用于tabBarItabBarItem和NavigationBarItem。那么此时如何分别设置? 答:在初始化方法里设置self.title可以设置TabBarItem的title,而设置self.navigationBarItem.title可以设置NavigationBarIte
2013-01-30 11:06:35 2113
原创 NSDictionary不简单
字典里某个键key的值可能是空数组~~~那这个[dic objectForkey:key]是什么?你猜会是[NSNull null]?也可能不是~~~但至少是个空数组。[[dic objectForkey:key] count]会告诉我们结果。下面的代码使用了NSNull来判断字典某个键的值是否为空。但是这种判断方法,似乎对于空集合类不大奏效。 id obje
2013-01-28 00:19:52 4520
转载 UISearchBar和UISearchDisplayController
原文 http://hi.baidu.com/happywilma0118/item/e6d5730a499bba1b3a53eef8 UISearchBar继承自UIView、UIResponder、NSObject 属性: autocapitalizationType————自动对输入文本对象进行大小写设置(包含4种类型,但是有时候键盘会屏蔽此属性) autocor
2013-01-26 20:52:52 2497
转载 iOS目录操作
//NSCachesDirectory NSCachesDirectory NSLibraryDirectory NSString *homeDirectory = NSHomeDirectory(); //获取程序HOME目录 NSString *tempDirectory = NSTemporaryDirectory(); //获取程序缓存目录 NS
2013-01-26 20:08:39 690
转载 UIScrollView 原理详解
转自http://blog.csdn.net/ch_soft/article/details/6947695ScrollView UIScrollView UIScrollView为了显示多于一个屏幕的内容或者超过你能放在内存中的内容。 Scroll View为你处理缩小放大手势,UIS
2013-01-26 20:00:47 1253
原创 sizeWithFont:方法使用明细
个人总结:Computing Metrics for a Single Line of Text– sizeWithFont: 同下面,换行方式默认取NSLineBreakByWordWrapping– sizeWithFont:forWidth:lineBreakMode: 将字符串放入指定宽度,如果不够,就依据换行方式截断字符串,返回其大小。– sizeWithFont:m
2013-01-25 15:41:49 15540 1
转载 GCD介绍(四): 完结
转自http://www.dreamingwish.com/dream-2012/gcd-four-the-the-odds-and-ends.htmlDispatch Queue挂起dispatch queue可以被挂起和恢复。使用 dispatch_suspend函数来挂起,使用 dispatch_resume 函数来恢复。这两个函数的行为是如你所愿的。另外,这两
2013-01-25 13:08:03 984
转载 GCD介绍(三): Dispatch Sources
转自:http://www.dreamingwish.com/dream-2012/gcd%E4%BB%8B%E7%BB%8D%EF%BC%88%E4%B8%89%EF%BC%89-dispatch-sources.html何为Dispatch Sources简单来说,dispatch source是一个监视某些类型事件的对象。当这些事件发生时,它自动将一个block放
2013-01-25 13:06:54 925
转载 GCD介绍(二): 多核心的性能
转自http://www.dreamingwish.com/dream-2012/of-of-of-performance-of-of-of-of-of-of-of-gcd-introduced-ba-the-multi-core.html概念为了在单一进程中充分发挥多核的优势,我们有必要使用多线程技术(我们没必要去提多进程,这玩意儿和GCD没关系)。在低层,GCD全局disp
2013-01-25 13:05:17 830
转载 GCD介绍(一): 基本概念和Dispatch Queue
转自http://www.dreamingwish.com/dream-2012/of-of-of-of-gcd-introduced-1-basic-concepts-in-and-the-dispatch-queue.html什么是GCD?Grand Central Dispatch或者GCD,是一套低层API,提供了一种新的方法来进行并发程序编写。从基本功能上讲,GCD有点像
2013-01-25 12:53:41 1147
转载 关于模态弹窗点击灰色区域消失
标题是不是写的很有诗意?我自己也觉得有点儿迷糊,其实就是这样需求:模态弹出来的窗口,需要点击窗口以外的区域,也就是模态区域让这个窗口消失。一般这种场景会出现在iPad里,当你modalPresentationStyle为UIModalPresentationFormSheet时,会有这种需求。网上找了一下,这种东东还真能实现,于是想着UIAlertView是不是也可以实现呢?你猜咋地,竟然真的可以
2013-01-24 17:52:46 2128
转载 CALayer 的一些重要属性
下面就逐个过下 CALayer 的一些重要属性: 1. shadowPath : 设置 CALayer 背景(shodow)的位置 2. shadowOffset : shadow 在 X 和 Y 轴 上延伸的方向,即 shadow 的大小 3. shadowOpacity : shadow 的透明效果 4. shadowRadius : shadow 的渐变距离,
2013-01-23 23:59:13 1596
转载 iPhone/iOS Core Animation开发总结(CALayer)
转自http://blog.csdn.net/jerryvon/article/details/7527247一.重要参数bounds,frame,position属于基本的几何定位,相互之间数值变化会相互影响anchorPoint:单位参数(0-1)表示,变形(transform)时候的变换源点zPosition:相当于css中z-index的概念,Apple建议不要
2013-01-23 21:23:17 904
转载 core animation 入门教程(已添加第三章)
转自http://www.cocoachina.com/bbs/read.php?tid=10972&uid=2406由于本人水平有限,有错误的地方请指教。谢谢。 by译者 long4success @CocoaChina第一章 Core animation简介1. 简介Core animation 是以objc语言封装的一套图形渲染,投影及
2013-01-23 21:21:42 891
原创 小议contentsRect
参考文献:http://blog.csdn.net/mengtnt/article/details/7100564contentsRect 想像下contentsRect作为层内容的可视区域。内容的矩形区域(x,y,width,height)也是绑定到层的框架上的。contentRect是一个比例值,而不是屏幕上真实的像素点。默认的是0.0,0.0,1.0,1.0.当你改
2013-01-23 17:35:50 5533
转载 The truth about synchronous NSURLConnection
In this post, I'll talk about NSURLConnection, the advantages and disadvantages about synchronous versus asynchronous connections. At the end I'll show a snippet of code on how to use an asynchronous
2013-01-23 14:26:16 1292 1
转载 有用的小代码
常用代码整理:12.判断邮箱格式是否正确的代码://利用正则表达式验证-(BOOL)isValidateEmail:(NSString *)email{NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";NSPredicate *emailT
2013-01-23 13:01:26 598
转载 UIActionSheet的最后一项点击失效
在开发过程中,发现有时候UIActionSheet的最后一项点击失效,点最后一项的上半区域时有效,这是在特定情况下才会发生,这个场景就是试用了UITabBar的时候才有。解决办法:在showView时这样使用,[actionSheet showInView:[UIApplication sharedApplication].keyWindow];或者[sheet showInView:[A
2013-01-22 12:40:17 563
转载 隐藏Tabbar的一些方法
由于手机界面比较小,有时候由于业务的需要,需要隐藏那个导航用的tabbar,方法有下面几个方法 方法一 YourAppDelegate *app = (YourAppDelegate *)[UIApplication sharedApplication].delegate; NSArray *views = [app.tabBarController.view su
2013-01-22 11:51:55 968
转载 iOS Singleton 单例模式
1. 为 Singleton Object 实现一个静态实例,并初始化,然后设置成nil;2. 实现一个实例构造方法 (通常命名为 sharedInstance 或者 sharedManager) 检查上面声明的静态实例是否为nil,如果是,则新建并返回一个本类实例;3. 重写allocWithZone: 方法,用来保证当其他人直接使用 alloc 和init 试图获得一个新实例的时候,
2013-01-21 17:55:59 2462
转载 UITableViewCell的重绘机制导致的列状态问题
虽然还没遇到过,但是这样做法还是比较健壮的。问题:UITableViewCell的重绘机制导致的列状态问题环境:XCode4.2,低版本也会出现场景:自定义UITableViewCell,使用复用cell方法,在UITableView滚动时,内容被覆盖,或者没有被刷新,或者选择时内容覆盖,或者设置cell的背景透明时,内容重叠在一起,或者图片控件出现覆盖,显示不全等
2013-01-20 22:51:38 818
转载 iOS学习笔记——Core Data
转载自http://hxsdit.com/1622部分内容来自:《Cocoa 基本原理指南》,部分内容翻译自:《Core Data Basics》7.1. 什么是Core Data Core Data是一个Cocoa框架,用于为管理对象图提供基础实现,以及为多种文件格式的持久化提供支持。管理对象图包含的工作如撤销(undo)和重做(redo)、有效性检查、
2013-01-20 15:14:18 1774 1
原创 Fetch Request must have an entity错误和引入coredata.framework
在使用core data的时候难免粗心出些状况。遇到Fetch Request must have an entity错误的时候,无非是排查2部分。NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"TextField" inManagedObjectContext:context];首
2013-01-18 17:15:31 4902
原创 【评】iPhone应用中使用NSLocalizedString实现国际化
iPhone应用中使用NSLocalizedString实现国际化是本文要介绍的内容,不多说,直接进入话题。获取系统所支持的国际化信息在国际化之前,你可以在iphone中的”设置->通用->多语言环境->语言”中来查看你的iphone支持哪些语言,当然也可以写一段代码测试一下你的iphone都支持哪些语言.测试代码如下: NSUserDefaults *defaults = [NSU
2013-01-16 20:15:15 894
转载 自定义 UITableViewCell 的布局
转自http://my.oschina.net/lvlove/blog/93778自定义TableViewCell 布局有很多种,个人建议简单的cell使用第一种,复杂的用第二种。除此之外还有很多种实现方法,但是从代码重用的角度来说不是很好,没有写的必要。 言归正传: 1) 程序默认带有一个 ImageView , 一个textLabel, 一个DetailL
2013-01-15 13:36:45 4711
转载 textField被虚拟键盘挡住解决方法
经常会遇到以下情况,textField被虚拟键盘挡住的情况,解决。RootViewController.h 中:#import @interface RootViewController : UIViewController { UITextField *textField1; UITextField *textField2; }@property (n
2013-01-14 22:48:17 1682 1
原创 深入理解iOS API系列(五)dequeueReusableCellWithIdentifier:
Table Data Source Methods中的一个必要实现的方法tableView: cellForRowAtIndexPath: 中经常会包含一段代码:static NSString *FirstLevelCell = @"FirstLevelCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithId
2013-01-14 18:08:34 31222 1
转载 iOS关闭键盘的两种简单方法
下面两种关闭键盘的方法,我好像都还没用过方法一: //1, 关闭键盘 [[[UIApplication sharedApplication] keyWindow] endEditing:YES]; 想必大家都遇到过一个view上好多输入框,为了关闭弹出的软键盘要遍历然后调用resignFirstRespo
2013-01-14 10:47:25 1757
原创 UINavigationController记录
首先看则新闻:iOS 6也玩功能彩蛋 顶部状态栏会变色以往的彩蛋只会出现在各大厂商开发的游戏大作中,而如今苹果公司也玩起了彩蛋?在上周WWDC 2012苹果研发者大会上,苹果公司曝光了其新系统iOS 6的近200多项新功能,虽然没有什么特别的惊喜,但也足以让果粉大饱眼福。可细心的玩家在下载了iOS 6预览版之后,竟发现了好多有趣的苹果公司尚未公之于众的细节,比如同性恋图标,最有
2013-01-14 10:34:26 2047 1
转载 UITabBarController使用详解
转自http://www.cnblogs.com/smileEvday/archive/2012/05/20/UITabBarController.html UITabBarController是IOS中很常用的一个viewController,例如系统的闹钟程序,ipod程序等。UITabBarController通常作为整个程序的rootViewCo
2013-01-12 14:06:38 2332
转载 object-c开发中混合使用或不使用ARC
xcode不断进步,在xcode4中引入了ARC的概念。您用或者不用它就在那里,于是有了本文:如何在未使用arc的工程中引入一个使用了arc特性的文件,如何在arc工程中引用未使用arc的文件。其实说白了也很简单就是在”Compile Sources”中对相应的文件加入使用或者不使用arc的flagok,首选“Compile Sources”的位置:选中工程->TARGETS->相应的targ
2013-01-12 13:20:04 1254
转载 IOS学习笔记21—沙盒机制(SandBox)
IOS中的沙盒机制(SandBox)是一种安全体系,它规定了应用程序只能在为该应用创建的文件夹内读取文件,不可以访问其他地方的内容。所有的非代码文件都保存在这个地方,比如图片、声音、属性列表和文本文件等。1.每个应用程序都在自己的沙盒内2.不能随意跨越自己的沙盒去访问别的应用程序沙盒的内容3.应用程序向外请求或接收数据都需要经过权限认证查看模拟器的沙盒文件夹在Mac电脑上的
2013-01-11 15:55:33 704
转载 UIApplication sharedApplication详细解释-IOS
iPhone应用程序是由主函数main启动,它负责调用UIApplicationMain函数,该函数的形式如下所示: int UIApplicationMain ( int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName ); 那么UIApplicationMai
2013-01-11 15:54:35 960
转载 iOS 数据持久化 NSUserDefault 的使用 NSUserDefaults读取和写入自定义对象
基本使用: 创建一个user defaults方法有多个,最简单得快速创建方法: NSUserDefaults *accountDefaults = [NSUserDefaults standardUserDefaults]; 添加数据到 user defaults: [accountDefaults setObject:nameField.text forKey:
2013-01-11 15:52:40 13263 1
原创 用分类实现前缀后缀添加
我特别喜欢分类,而它的确是处理一些小问题的好帮手,在本例中使用分类来实现给一个NSString添加前后缀的方法。代码简单,就不多说了,可以帮助初学者掌握分类的使用方法。//// NSString+PrefixAndSuffix.h// AddPrefixAndSuffix//// Created by Mamong on 13-1-11.// Copyrigh
2013-01-11 14:19:29 1508
原创 属性,点语法,实例变量
这三者,初学者往往会犯糊涂。怎么来区分呢? 属性往往和synthesize配合来产生设置器和获取器,一般建议的话,对于类的实例变量的访问通过获取和设置器。现在有了自动synthesize这个特性后就不需要在.m文件里synthesize。现在还支持只有属性,而不声明实例变量。其实属性已经隐含地生成了一个_开头的实例变量,这样我们就可以在.m文件中直接用。但是如果你既声明实例变量,又声明
2013-01-10 16:38:07 882
转载 缩略图by keefo
自己扩展的方法 - (NSImage *)resizeTo:(NSSize)newsize { NSRect rect=NSMakeRect(0, 0, newsize.width, newsize.height); NSImage *resizedImage = [[NSImage alloc] initWithSize:rect.size]; [re
2013-01-10 10:51:55 689
原创 关于Application windows are expected to have a root view controller at the end of application launch
Application windows are expected to have a root view controller at the end of application launch这个问题在新版xcode和iOS6中出现,一些iOS5的经典著作的例子可能会有这种警告,解决的办法是添加一句 [self.window setRootViewController: rootControlle
2013-01-09 23:51:47 11578
原创 关于[datePicker date]不正确显示当地时间的问题
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm +0800"];NSString *destDateString = [dateFormatter stringFromDate:selected];格式化时间…
2013-01-09 22:26:21 2586
转载 nsbundle
-- 思考: NSBundle ---bundle是一个目录,其中包含了程序会使用到的资源. 这些资源包含了如图像,声音,编译好的代码,nib文件(用户也会把bundle称为plug-in). 对应bundle,cocoa提供了类NSBundle.我们的程序是一个bundle. 在Finder中,一个应用程序看上去和其他文件没有什么区别. 但是实际上它是一个包含了nib文件,编译代码,以及
2013-01-09 22:23:21 785
[cnswift.org翻译]最新swift 5.5中文翻译
2021-08-24
[cnswift.org翻译]最新swift 5.3中文翻译
2021-04-06
[cnswift.org翻译]最新swift 5.1中文翻译
2019-07-07
ARKit by Tutorials, 2nd Edition
2019-05-21
[cnswift.org翻译]最新swift 5中文翻译
2019-03-09
Apress.Beginning.Machine.Learning.in.iOS.CoreML.Framework
2019-02-22
[cnswift.org翻译]最新swift 4.2 alpha中文翻译
2018-08-06
iOS Programming: The Big Nerd Ranch Guide (4th Edition) (Big Nerd Ranch Guides)
2014-03-04
iOS 7 App Development Essential
2013-11-27
Effective Objective-C 2.0
2013-11-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人