随笔分类 - iOS Project
摘要:主要为了解决引用死锁1.import会包含这个类的所有信息,包括实体变量和方法,而@class只是告诉编译器,其后面声明的名称是类的名称,至于这些类是如何定义的,暂时不用考虑,后面会再告诉你。2.在头文件中, 一般只需要知道被引用的类的名称就可以了。 不需要知道其内部的实体变量和方法,所以在头文件中一般使用@class来声明这个名称是类的名称。 而在实现类里面,因为会用到这个引用类的内部的实体变量和方法,所以需要使用#import来包含这个被引用类的头文件。3.在编译效率方面考虑,如果你有100个头文件都#import了同一个头文件,或者这些文件是依次引用的,如A–>B, B–>C
阅读全文
摘要:p38@interface 定义类的公共接口,用来提供类的公共描述通常被成为API application programming interface@implementation 中可以定义那些在@interface中无相应声明的方法,可以把它们当做是私有方法,仅在类的实现中使用。事实上,obj中不存在真正的私有方法,也无法把某个方法标识成私有方法,从而禁止其他代码调用它。这是obj动态本质的副作用。p39@interface和@implementation间的参数名不同是正确的。如果使用相同的变量名会隐藏初始变量,可以为参数使用新的名称来避免问题。p64getter方法engine返回实.
阅读全文
摘要:https://github.com/mobileresearch/weibo_ios_sdk_sso-oauth新浪微博 http://open.weibo.com/wiki/移动客户端接入#.E5.A6.82.E4.BD.95.E7.94.B3.E8.AF.B7Appkey微博开放平台http://open.weibo.com/apps/1118660852/info/basic
阅读全文
摘要:添加MessageUI. framework#import <MessageUI/MessageUI.h>MFMailComposeViewControllerDelegate#pragma mark -#pragma mark MFMailComposeViewController- (void) alertWithTitle:(NSString *)_title_ msg:(NSString *)msg { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:_title_ ...
阅读全文
摘要:NSString* string; // 结果字符串NSString* string1, string2; //已存在的字符串,需要将string1和string2连接起来//方法1. string = [NSString initWithFormat:@"%@,%@", string1, string2 ];//方法2. string = [string1 stringByAppendingString:string2];//方法3 . string = [string stringByAppendingFormat:@"%@,%@",string1,
阅读全文
摘要:NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *now2; NSDateComponents *comps = [[NSDateComponents alloc] init]; NSInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit | NSHourCalenda...
阅读全文
摘要:1.首先不复用static NSString *imageCellIdentifier = @"imageCell";...//这种为复用cell = [tableView dequeueReusableCellWithIdentifier:imageCellIdentifier];//这种为不复用cell = [[[UserCellView alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:imageCellIdentifier] autorelease];2.需要复用tableView有代
阅读全文
摘要:1.UILabel 换行1 versionLabel.lineBreakMode = UILineBreakModeWordWrap;3 versionLabel.numberOfLines = 0;2.UILabel 阴影1 tipLabel.shadowColor = [UIColorwhiteColor];2 tipLabel.shadowOffset = CGSizeMake(1.0, 1.0);3.自定义 View 实现drawRect方法@interface CustomView :UIView@end@implementation CustomView- ...
阅读全文