Fork me on GitHub
上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 125 下一页

2012年2月16日

摘要: http://www.iloss.me/?p=545协议分非正式协议和正式协议先说说非正式协议非正式协议在Obj-c中关键字虽然是interface,但是这个和C#中的借口并不完全相同。回忆之前学过的内容,我们定义一个类Sample时,会生成一个Sample.h,代码如下:#import <foundation foundation.h>@interface Sample:NSObject {}-(void) HelloWorld;@end它表明Sample类中,约定了应该有一个名为HelloWorld的方法(注:这里说的时应该,而不是必须)它只是一种君子协议。如果我们在Sampl 阅读全文
posted @ 2012-02-16 13:58 pengyingh 阅读(182) 评论(0) 推荐(0)
摘要: 1 #import <Foundation/Foundation.h> 2 3 typedef enum { 4 item = 0 , 5 image = 1 , 6 avatar = 2 7 } sandboxItemtype; 8 9 10 @interface UpdateManager : NSObject {11 sandboxItemtype _itemType;//存储信息类型,暂时没用上12 NSString *_filePath;//记录更新日志存储路径13 NSString *_timePath;14 NSStr... 阅读全文
posted @ 2012-02-16 13:52 pengyingh 阅读(548) 评论(0) 推荐(0)
摘要: http://www.iloss.me/?p=944直接贴代码了:- (CGAffineTransform)transformForOrientation { UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; if (UIInterfaceOrientationLandscapeLeft == orientation) { return CGAffineTransformMakeRotation(M_PI*1.5); } else if (UIInterfa. 阅读全文
posted @ 2012-02-16 09:22 pengyingh 阅读(4989) 评论(0) 推荐(0)
摘要: 本文转自:http://www.wangdg.com/?p=597 代码如下:#include <sys/param.h> #include <sys/mount.h>long long freeSpace() { struct statfs buf; long long freespace = -1; if(statfs("/", &amp;buf) &gt;= 0){ freespace = (long long)buf.f_bsize * buf.f_bfree; } return freespace;}+(float)getT 阅读全文
posted @ 2012-02-16 09:15 pengyingh 阅读(1412) 评论(0) 推荐(0)
摘要: 文章转自:http://www.wangdg.com/?p=482#import <mach/mach.h>#import <mach/mach_host.h>static void print_free_memory () { mach_port_t host_port; mach_msg_type_number_t host_size; vm_size_t pagesize; host_port = mach_host_self(); host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); ... 阅读全文
posted @ 2012-02-16 09:14 pengyingh 阅读(442) 评论(0) 推荐(0)
摘要: NSString*artist=@"王杰";NSString*song=@"什么时候才能够";转换后Artist=8B737067&Title=C04E484EF66519504D62FD801F59算法-(NSString*)toUnichar:(NSString*)src{ NSMutableString*arX=[NSMutableStringstring]; for(inti =0; i<[srclength]; i++) { unicharch= [srccharacterAtIndex:i]; unicharb = ((((un 阅读全文
posted @ 2012-02-16 09:13 pengyingh 阅读(1061) 评论(0) 推荐(0)
摘要: Objective-C学习笔记之获取私有变量的值是本文要介绍的内容,主要讲述了如何获取私有变量的值,来看本文详细内容。1、下面是自己定义的一个类,里面有一个私有变量mt_,并且在初始化值为"Ha Ha Ha"。@interfaceMobj:NSObject{ @private NSString*mt_; } @end @implementationMobj -(id)init{ self=[superinit]; if(self){ mt_=[[NSStringalloc]initWithString:@"HaHaHa"]; } returnself; 阅读全文
posted @ 2012-02-16 08:28 pengyingh 阅读(2424) 评论(0) 推荐(0)
摘要: 关于变量的作用域@protected—Methods defined in the class and any subclasses can directly access the instance variables that follow.This is the default case.该类和所有的子类中的方法可以直接访问这样的变量,这是默认的。@private—Methods defined in the class can directly access the instance variables that follow, but subclasses cannot.该类中的方法可 阅读全文
posted @ 2012-02-16 08:21 pengyingh 阅读(1076) 评论(0) 推荐(0)
摘要: 去除username中的空格,table newline,nextline代码如下:(三行代码)NSCharacterSet *whitespace = [NSCharacterSetwhitespaceAndNewlineCharacterSet];NSString *username= [mUsernameField stringValue];username = [usernamestringByTrimmingCharactersInSet:whitespace];注释:stringByTrimmingCharactersInSet:Returns a new string made 阅读全文
posted @ 2012-02-16 08:00 pengyingh 阅读(4480) 评论(0) 推荐(0)
摘要: 在所有的移动开发平台数据持久化都是很重要的部分:在j2me中是rms或保存在应用程序的目录中,在symbian中可以保存在相应的磁盘目录中和数据库中。symbian中因为权限认证的原因,在3rd上大多数只能访问应用程序的private目录或其它系统共享目录。在iphone中,apple博采众长,提供了多种数据持久化的方法,下面笔者会逐个进行详细的讲解。iphone提供的数据持久化的方法,从数据保存的方式上讲可以分为三大部分:属性列表、对象归档、嵌入式数据库(SQLite3)、其他方法。一、属性列表NSUserDefaultsNSUserDefaults类的使用和NSKeyedArchiver有 阅读全文
posted @ 2012-02-16 07:57 pengyingh 阅读(334) 评论(0) 推荐(0)
上一页 1 ··· 92 93 94 95 96 97 98 99 100 ··· 125 下一页

导航