#include int alloc_chrdev_region(dev_t *dev,
unsigned int firstminor, unsigned int count, char *name)dev_t 设备号(...
分类:
其他好文 时间:
2014-05-09 18:15:00
阅读次数:
279
使用语句:extern void *malloc(unsigned int
num_bytes);头文件:在TC2.0中可以用malloc.h或 alloc.h (注意:alloc.h 与 malloc.h
的内容是完全一致的),而在Visual C++6.0中可以用malloc.h或者stdlib...
分类:
其他好文 时间:
2014-05-06 00:32:40
阅读次数:
279
在IOS中,所有对象的内存分配的方法都会调用allocWithZone,比如构造函数alloc,所以重写这个方法就可以实现单例。
Xcode中预先写好了实现代码的快捷指令,敲dispatch_once就会看到。这个是有GCD实现的单例代码。实现代码如下:+(id)allocWithZone:(...
分类:
移动开发 时间:
2014-05-05 22:09:11
阅读次数:
392
不可变数组 ——NSArray常用的初始化一个数组: NSArray *array1 =
[[NSArray alloc] init]; NSArray *array2 = [NSArray array];
//对于上述两个方法,在NSArray中用的很少,因为这是一个空数组,它的值是不可...
分类:
其他好文 时间:
2014-05-05 11:25:12
阅读次数:
272
//1、创建常量字符串。NSString *astring = @"This is a
String!";//2、创建空字符串,给予赋值。NSString *astring = [[NSString alloc] init]; astring =
@"This is a String!"; [ast...
分类:
其他好文 时间:
2014-05-05 11:22:48
阅读次数:
238
UIButton * btn = [[UIButton
alloc]initWithFrame:CGRectMake(100, 100, 100, 100)]; [btn
setTitle:@"default"forState:UIControlStateNormal]; btn.bac...
分类:
移动开发 时间:
2014-05-05 10:25:57
阅读次数:
514
1.sgi STL"标准"的空间适配器: 该适配器很简单,只是对new
delete等内存分配释放函数的一层简单封装而已,所以sgi stl几乎没用上它(效率太低),代码位于defalloc.h.2.sgi stl特殊适配器
std::alloc: 该版本作为stl中的默认适配器,主要分成两个部分:...
分类:
其他好文 时间:
2014-05-04 12:41:42
阅读次数:
381
UIImagePickerController#pragma mark 从用户相册获取活动图片-
(void)pickImageFromAlbum{ imagePicker = [[UIImagePickerController alloc] init];
imagePicker.del...
分类:
其他好文 时间:
2014-05-04 10:41:38
阅读次数:
337
NSString *str1 = @"a string"; NSString *str2 =
[[NSString alloc] init]; str2 = @"a string"; [str2 release]; NSString *str3 =
[[NSString...
分类:
其他好文 时间:
2014-05-02 09:04:17
阅读次数:
185
在ios6以后,ios系统改变了屏幕旋转的方法,如果要设置屏幕旋转的方法,需要在rootvc里面进行编写,例如
UIViewController *viewCtrl = [[UIViewController alloc] init];
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRoot...
分类:
其他好文 时间:
2014-04-30 22:24:39
阅读次数:
254