摘要: //检查数据库|| 复制数据库文件 NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *folderPath = [searchPaths objectAtIndex:0]; NSString *dbfilePath = [folderPath stringByAppendingPathComponent:DB_FILE_NAME]; if (![[NSFileManager defaultMan... 阅读全文
posted @ 2011-11-01 17:38 痴人指路 阅读(197) 评论(0) 推荐(0) 编辑
摘要: //写入:NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString *dataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@”sqlite.sqlite”];NSData *image=UIImagePNGRepresentation([UIImage imageNamed:@"01_02.png"]);NSString *aaa=[[NSS 阅读全文
posted @ 2011-11-01 17:07 痴人指路 阅读(406) 评论(0) 推荐(0) 编辑
摘要: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//多页面操作mydata.plist if (![[NSFileManager defaultManager] fileExistsAtPath:[[paths objectAtIndex:0] stringByAppendingPathComponent:@"mydata.plist"]]) { if ([[NSFileManager defaultManager] copyIt 阅读全文
posted @ 2011-11-01 09:30 痴人指路 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://liangbing8612.blog.51cto.com/2633208/697911情形1#include<stdio.h> #include<stdlib.h> #include<string.h> voidGetMemory(char*p) { p=(char*)malloc(100); } voidTest(void) { char*str=NULL; GetMemory(str); strcpy(str,"hellowor 阅读全文
posted @ 2011-10-29 11:06 痴人指路 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 1)obj-c的编译器处理后缀为m的文件时,可以识别obj-c和c的代码,处理mm文件可以识别obj-c,c,c++代码,但cpp文件必须只能用c/c++代码,而且cpp文件include的头文件中,也不能出现obj-c的代码,因为cpp只是cpp2) 在mm文件中混用cpp直接使用即可,所以obj-c混cpp不是问题3)在cpp中混用obj-c其实就是使用obj-c编写的模块是我们想要的。如果模块以类实现,那么要按照cpp class的标准写类的定义,头文件中不能出现obj-c的东西,包括#import cocoa的。实现文件中,即类的实现代码中可以使用obj-c的东西,可以import,只 阅读全文
posted @ 2011-10-26 14:07 痴人指路 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 第一种方法是用系统api的方式获取,如下 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> #inc 阅读全文
posted @ 2011-10-26 12:56 痴人指路 阅读(376) 评论(0) 推荐(0) 编辑
摘要: http://fei263.blog.163.com/blog/static/9279372420114276519394/这个自定义多色彩文本 Layer 的代码例子由 CocoaChina 会员 “带睡帽的青蛙” 分享,无需 three20,可以一个一个单词的定义文本颜色,并且可以调整词间距和行间距,根据 layer 的大小自动换行/** * @file ColoredTextLayer.h * @author * @date * @version Beta 1.0 * @desc... 阅读全文
posted @ 2011-10-25 12:40 痴人指路 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 注册键盘弹出消息:[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];移除注册:[[NSNotification... 阅读全文
posted @ 2011-10-25 11:20 痴人指路 阅读(441) 评论(0) 推荐(0) 编辑
摘要: http://fei263.blog.163.com/blog/static/927937242011511032058/ #import <Foundation/Foundation.h> @interface UIImage (CS_Extensions) - (UIImage *)imageAtRect:(CGRect)rect; - (UIImage *)imageByScalingProportionallyToMinimumSize:(CGSize)targetSize; - (UIImage *)imageByScalingProportionallyTo... 阅读全文
posted @ 2011-10-25 09:24 痴人指路 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 将项目转移至SDK5后出现不少问题。其中一个便是在sdk4下可以正常返回的dismissModalViewController,在sdk5下有部 分不起作用。大概原因是因为调用presentModalViewController的那个controller是放在 UINavigationController或者UITabbarViewController,没有具体测试。不过查看最新的sdk5文档。解决方案 如下:view plain?12345// The view controller that was presented by this view controller or its nea. 阅读全文
posted @ 2011-10-21 11:37 痴人指路 阅读(1233) 评论(0) 推荐(0) 编辑