03 2013 档案
摘要:1、纯虚函数:类中函数声明为 virtual void foo() = 0;则此类不能实例化,为抽象类,子类若不实现纯虚函数,也不能实例化,继续为抽象类,直到实现父类所有纯虚函数为止。2、const后谁离const最近const就修饰谁const int a = 1; 或 int const a = 1; 都是修饰a,a为只读,且声明时必须初始化const int *a; 或 int const * a; const后为*,则表示修饰a指向的内容*a的值为readonlyint * const a; const后是a,则a的值为readonlyvoid foo() const; 表示foo..
阅读全文
摘要:重写drawRect后,设置layer的属性会失效,可能在drawRect中还会对layer进行改变所以要设定view的边框形状有两种方法:1、重写drawRect,用UIBezierPath等画出圆角矩形或者圆,然后addClips,将边框包裹住,最后要注意将view的背景色设置为透明。2、不重写drawRect,初始化中改变view.layer的属性,可以变为圆角矩形,圆,还能设置阴影,边框等,但是要注意layer的maskToBounds和view的clipsToBounds属性,保证只在bounds内绘图。
阅读全文
摘要:1、NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];CGFloat cellHeight = [selftableView:self.tableView heightForRowAtIndexPath:indexPath];2、NSIndexPath *indexPath = [self.tableViewindexPathForCell:cell];CGFloatcellHeight =[self.tableView rectForRowAtIndexPath:indexPath].size.height;
阅读全文
摘要:和delegate一样,KVO和NSNotification的作用也是类与类之间的通信,与delegate不同的是1)这两个都是负责发出通知,剩下的事情就不管了,所以没有返回值;2)delegate只是一对一,而这两个可以一对多。这两者也有各自的特点。1)KVO的使用:被观察者发出 addObserver:forKeyPath:options:context: 方法来添加观察者- (void)addObserver:(NSObject *)anObserver forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)
阅读全文
摘要:git rm --cached Q\&A.xcodeproj/project.xcworkspace/xcuserdata/lty.xcuserdatad/UserInterfaceState.xcuserstate
阅读全文

浙公网安备 33010602011771号