1.Core Data
http://blog.csdn.net/javayujiafeng/article/details/8935224
2.NSURLSessionDataDelegate
http://www.apihome.cn/api/ios/NSURLSessionDataDelegate%20Protocol%20Reference.html
这个delegate不是必须的,当创建的task自身含有completion handler block时候,delegate不生效
但是,当delegate和backgroundSessionConfiguration一起使用的时候,可以完成一件事:当app触发了获取数据的操作,但是完成的时候app处于后台,在两者结合的时候,就可以能够完成对 数据获取完成 的响应。
3.后台触发fetch
to be continued
4.@interface @implemetation
http://stackoverflow.com/questions/9102861/when-why-do-you-use-interface-classname-private-objective-c
class就是一种特殊的category,唯一的区别就是需要有@implemetation实现部分
@interface中定义了一些私有的方法和属性
5.view's bounds & frame
一图以概之
6.NSBundle
https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/index.html
NSBundle代表了所有代码和资源集合包的位置,可以使用其在程序中获取一些数据或者图片
NSURL *soundURL = [[NSBundle mainBundle] URLForResource:@"win"
withExtension:@"wav"];
7.view life cycle
init-初始化程序
viewDidLoad-加载视图,即view被加载到memory
viewWillAppear-UIViewController对象的视图即将加入窗口时调用;
viewDidAppear-UIViewController对象的视图已经加入到窗口时调用;一般image picker全屏显示view之后,回退到当前view的时候,只会调用
viewDidAppear,而不会调用viewDidLoad
viewWillDisappear-UIViewController对象的视图即将消失、被覆盖或是隐藏时调用;
viewDidDisappear-UIViewController对象的视图已经消失、被覆盖或是隐藏时调用;
viewVillUnload-当内存过低时,需要释放一些不需要使用的视图时,即将释放时调用;
viewDidUnload-当内存过低,释放一些不需要的视图时调用。
8.dispatch_once
你现在在应用中就有一个共享的实例,该实例只会被创建一次。
该方法有很多优势:
1 线程安全
2 很好满足静态分析器要求
3 和自动引用计数(ARC)兼容
4 仅需要少量代码
9.autolayout
http://www.cocoachina.com/industry/20131203/7462.html
如果有些无法使用autolayout,就结合5 frame和 7 初始化view一些列方法,用代码写好layout吧
比如说在一个toolbar中插入一个segmented control,不像在navigation bar中插入segmented control,如果拖拽,都不会过界(parent view navigation bar),则需要结合viewDidAppear和frame写好即可
10.CGSize CGPoint CGRect
/* Points. */
struct CGPoint {
CGFloat x;
CGFloat y;
};
typedef struct CGPoint CGPoint;
/* Sizes. */
struct CGSize {
CGFloat width;
CGFloat height;
};
typedef struct CGSize CGSize;
/* Rectangles. */
struct CGRect {
CGPoint origin;//偏移是相对父窗口的
CGSize size;
};
typedef struct CGRect CGRect;
http://blog.csdn.net/ganlijianstyle/article/details/7651489
11.Strong vs Copy vs Assign
A->B
A中的一个MutableString MString给B中的一个Property(NSString类型)赋值
首先是能接受的,父类可以接受子类,如果是strong,仅仅是生成一个指针,计数器加一,然后指向那个MutableString。
如果MString改变,B中那个跟着改变,因为是同一块内存区域。
而选择Copy相当于又生成了一个NSString,与A中的MutableString独立。
assign和copy是相反的,用于非指针变量。用于
基础数据类型 (例如NSInteger)和C数据类型(int, float, double, char, 等),另外还有id
12.Disclosure indicator vs Detail disclosure button
这两个都是tableview的accessory view
第一个意味着可以点进进入下一个详细table view
第二个有两种方法,一个是直接点击table view cell,进入detail view;另一个是点击右侧小箭头,进入详细table view
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/TableViewStyles/TableViewCharacteristics.html
13.NSFileManager vs Sandbox
http://blog.csdn.net/xyz_lmn/article/details/8968213
14.UIApplicationWillEnterForegroundNotification
当app从后台转到active时候,会发送这个notification给app
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/c/data/UIApplicationWillEnterForegroundNotification
15.GCD
这两篇博客讲解的比较简单,目前没必要深入了解
http://blog.csdn.net/totogo2010/article/details/8016129
http://blog.devtang.com/blog/2012/02/22/use-gcd/
16.TableView
- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier;
- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath
前者MRC,后者ARC
具体使用方式不同之处在于
1.需要判断是否返回的cell为nil,如果为nil,需要做相应的处理
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
SimpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:SimpleTableIdentifier];
}
2.则将if判断cell是否为nil省略,但是需要提前注册一个cell的class
一般可以在ViewDidLoad中注册
UITableView *tableView = (id)[self.view viewWithTag:1];
[tableView registerClass:[BIDNameAndColorCell class]
forCellReuseIdentifier:CellTableIdentifier];
后续就可以直接使用了
BIDNameAndColorCell *cell = [tableView dequeueReusableCellWithIdentifier:
CellTableIdentifier
forIndexPath:indexPath];
3.- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
这个函数主要定义了cell中view的呈现形式
17.initWithFrame vs initwithCoder
initWithFrame是由代码创建view的时候,才会调用此方法
而通过interface builder拖拽生成view,调用initWithCoder
http://blog.csdn.net/itianyi/article/details/8917026
18.Function Definition
- (id)initWithTitle:(NSString*)title ratings:(float)rating;
-代表instance type function + 代表class type function
id返回值类型
title和rating都是函数的输入,类型非别是NSString和float
调用形式为[myObject initWithTitle:foo rating:bar]
这样相对于C++ style,更能让调用者看清楚bar是rating这个信息
19.SKAction
SKScene中node执行的action,有非常多种类
详见https://developer.apple.com/library/prerelease/ios/documentation/SpriteKit/Reference/SKAction_Ref/index.html#//apple_ref/swift/cl/SKAction
20.MapKit Datatypes
mapkit的所有datatype
https://developer.apple.com/library/ios/documentation/MapKit/Reference/MapKitDataTypesReference/#//apple_ref/c/tdef/MKCoordinateRegion
21.CGAffineTransform
有人问CGAffineTransformMakeScale和CGAffineTransformScale有啥区别,其实很简单啊
如果当前已经有tranform矩阵了,即前面调用过任何tranform的make方法,想要在此基础上进行形变,则使用第二个,否则使用第一个make一个transform矩阵
https://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/CGAffineTransform/index.html
22.UIImagePickerController
两个用法:照相/拍视频或者从手机中读取照片/视频
首先source type分为 UIImagePickerControllerSourceTypeCamera和 UIImagePickerControllerSourceTypePhotoLibrary /UIImagePickerControllerSourceTypeSavedPhotosAlbum,对应上面两种情况
https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIImagePickerController_Class/index.html#//apple_ref/occ/instp/UIImagePickerController/sourceType
举个栗子
http://www.cnblogs.com/phnix/archive/2012/08/24/2653656.html
23.dismissViewControllerAnimated:completion:
dismiss的view会直接被移除内存,dealloc,重新加载的时候会调用viewDidLoad
举个栗子http://blog.csdn.net/terrylee_cold/article/details/7529132
24.NSRange
判断一个字符串是否包含在另一个字符串中
NSString *long = @“wa lala sa you na la";
NSRange range = [long rangeOfString: @"la"];
return range.location ! = NSNotFound
25.Use Core Data勾选框
创建项目时候如果勾选了Use Core Data,那么会自动生成core data存储方式(xcdatamodeld),且appdelegate会更加详细
http://www.cnblogs.com/xiaodao/archive/2012/10/08/2715477.html
26.NSData vs NSMutableData
NSData创建静态data object,相对NSMutableData创建动态data objects。常用于app之间传输的数据.
举个栗子 http://blog.csdn.net/yuxikuo_1/article/details/42709559
https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/index.html
27.UILabel strong vs weak
有些时候通过control drag声明的IBOutlet为weak,因为它一直存在于view中
如果通过代码声明和init时候,则需要声明为strong
28.@class
两种方式引入一个类,如果使用import方式,将会将类的方法大量编译进来,也比较容易出错
使用@class方式,引用类只是知道这是一个类,可以使用指针创建,类的其他信息一概不知。
http://wangrui.blog.techweb.com.cn/archives/17.html
https://developer.apple.com/wwdc/sessions/
http://onevcat.com/#blog
http://onevcat.com/2012/01/testflight/
http://blog.csdn.net/chengwuli125/article/details/11747483
http://www.infoq.com/cn/articles/ios-unit-test-1