码迷,mamicode.com
首页 >  
搜索关键字:alloc    ( 3259个结果
内存管理
由alloc、copy、new、mutableCopy修饰的对象都会使引用计数值加一 release:释放对象 release = 0时,废弃对象 (1)带有alloc/new/copy/mutableCopy关键字,是自己生成对象并持有,自己持有的对象,自己得释放(release) (2)取得任何 ...
分类:其他好文   时间:2017-11-24 15:12:55    阅读次数:146
创建单例的正确姿势
方法 1: 声明 :+ (instancetype)sharedInstance 单例方法 重写:+ (instancetype)allocWithZone:(struct _NSZone *)zone (+(instancetype)alloc 和 +(instancetype)new 都会走 a ...
分类:其他好文   时间:2017-11-24 14:53:01    阅读次数:352
C++primer 5 中 uninitialized_copy函数报错的问题
c++primer 中的一个函数报错的问题 StrVec类的设计中定义这个类,定义了一个static变量alloc,用来分配内存和构造元素 class StrVec{public: StrVec() :elements(nullptr), first_free(nullptr), cap(nullp ...
分类:编程语言   时间:2017-11-14 22:21:42    阅读次数:424
iOS学习——weak的应用场景
OC采用ARC机制,因此strong等属性也有了应用场景。当使用alloc为一个对象在堆中分配内存空间,然后让栈区使用一个强指针指向该内存地址,就能在指针被自动释放签前,保证堆内数据不被释放。那么如果不是用强指针,而是用弱指针执行该堆内存地址,那么在分配内存空间后就会自动释放。 那么,针对这种运用场 ...
分类:移动开发   时间:2017-11-13 19:52:24    阅读次数:158
char device
1 /** 2 * alloc_chrdev_region() - register a range of char device numbers 3 * @dev: output parameter for first assigned number 4 * @baseminor: first o... ...
分类:其他好文   时间:2017-11-11 19:01:29    阅读次数:169
iOS中时间与时间戳的相互转化
//获取当前系统时间的时间戳 #pragma mark - 获取当前时间的 时间戳 +(NSInteger)getNowTimestamp{ NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDate ...
分类:移动开发   时间:2017-11-08 11:58:25    阅读次数:235
iOS 强制退出程序APP代码
1、先po代码 // 退出程序 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 UIAlertView* alert = [[UIAlertView alloc] initWi ...
分类:移动开发   时间:2017-11-07 19:54:39    阅读次数:318
label 根据文字label自适应宽度
UILabel *Label = [[UILabel alloc]init]; Label.text = @"长一点也是可以的"; Label.textColor = black_Color; Label.textAlignment = NSTextAlignmentLeft; gsmcLabel. ...
分类:其他好文   时间:2017-11-03 13:11:24    阅读次数:159
iOS如何把一个CGPoint存入数组里
CGPoint itemSprite1position = ccp(100,200); NSMutableArray * array = [[NSMutableArray alloc] initWithObjects:NSStringFromCGPoint(itemSprite1position), ...
分类:移动开发   时间:2017-10-29 14:38:48    阅读次数:221
iOS 播放音频文件
// 播放音乐 NSString *path = [[NSBundle mainBundle] pathForResource:@"1670" ofType:@"mp3"]; NSError * error; self.avaPlayer= [[AVAudioPlayer alloc] initWi ...
分类:移动开发   时间:2017-10-17 12:21:05    阅读次数:183
3259条   上一页 1 ... 13 14 15 16 17 ... 326 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!