01 2013 档案
摘要:需要注意的是,要做缓存的Http请求必须用get方法来获取数据。1、设置全局的Cache 在AppDelegate.h中添加一个全局变量@interface AppDelegate : UIResponder <UIApplicationDelegate> { ASIDownloadCache *myCache; } @property (strong, nonatomic) UIWindow *window; @property (nonatomic,retain) ASIDownloadCache *myCache; 在AppDelegate.m中的- (BOOL)applic
阅读全文
摘要:assert 是C里面的宏,用于断言。NSAssert 只能在OC里面使用。是assert的一个扩充。能捕获assert异常,打印一些可读的日志。而assert只是让app crash(abort).在debug情况下,所有NSAssert都会被执行。在release下不希望NSAssert被执行的设置方法:在targets种选择build,选择release。在gcc preprocessing下增加Preprocessor Macros 值为 NS_BLOCK_ASSERTIONS.assert宏的原型定义在<assert.h>中,其作用是如果它的条件返回错误,则终止程序执行,
阅读全文
摘要:// 右边索引的标题数组- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{ NSMutableArray *array = [NSMutableArray array]; for(int section='A';section<='Z';section++) { [array addObject:[NSString stringWithFormat:@"%c",section]]; } return array;}// 自定义索引与数组的对应关系-
阅读全文
摘要:导入MessageUI.framework.h文件中#import<MessageUI/MessageUI.h>#import<MessageUI/MFMailComposeViewController.h>实现MFMailComposeViewControllerDelegate,MFMessageComposeViewControllerDelegate.m文件//邮件-(void)showMailPicker { ClassmailClass = (NSClassFromString(@"MFMailComposeViewController"
阅读全文
摘要://sdk中提供了方法可以直接调用UIImage*img=[UIImageimageNamed:@"some.png"];NSData*dataObj=UIImageJPEGRepresentation(img,1.0); //下面是sdk中UIImage.h头文件中的内容UIKIT_EXTERNNSData*UIImagePNGRepresentation(UIImage*image);//returnimageasPNG.MayreturnnilifimagehasnoCGImageReforinvalidbitmapformatUIKIT_EXTERNNSData*U
阅读全文
摘要:缩放图片比例- (UIImage *)TelescopicImageToSize:(CGSize) size{ UIGraphicsBeginImageContext(size); [self drawInRect:CGRectMake(0, 0, size.width, size.height)]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage;}
阅读全文
摘要:- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ [self pageScroll]; [self.refreshHeaderView headFreshScrollViewDidScroll:scrollView]; //+|+ NSLog(@"%f",scrollView.contentOffset.y); if (scrollView.contentOffset.y<0) { CGRect frame = CGRectMake(0, -20, 320, 40); ...
阅读全文
摘要:黑白0.3086, 0.6094, 0.0820, 0, 00.3086, 0.6094, 0.0820, 0, 00.3086, 0.6094, 0.0820, 0, 00 , 0 , 0 , 1, 0对比度(N取值为0到10)N,0,0,0,128*(1-N)0,N,0,0,128*(1-N)0,0,N,0,128*(1-N)0,0,0,1,0亮度(N取值为-255到255) 注:一般取值为-100到100(这里是PS中的取值宽度)1,0,0,0,N0,1,0,0,N0,0,1,0,N0,0,0,1,0颜色反相-1, 0, 0, 0, 2550 , -1, 0, 0, 2550 , 0,
阅读全文
摘要:#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)- (void)viewDidLoad{ [super viewDidLoad]; dispatch_async(kBgQueue, ^{ NSData* data = [NSData dataWithContentsOfURL: kLatestKivaLoansURL]; [self performSelectorOnMainThread:@selector(fetchedData:) withOb...
阅读全文