This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//创建一个下载队列 | |
dispatch_queue_t downloadQueue = dispatch_queue_create("flickr downloader", NULL); | |
dispatch_async(downloadQueue, ^{ | |
//在这里做一些需要资源的任务 | |
//分发两个行队列,分别执行do_first_work,do_second_work | |
dispatch_group_t group = dispatch_group_create(); | |
dispatch_group_async(group,dispatch_get_global_queue(0,0),^{ | |
do_frist_work(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "AFHTTPClient.h" | |
@interface APIClient : AFHTTPClient | |
+ (APIClient *)sharedClient; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The following function saves UIImage in test.png file in the user Document folder: | |
- (void)saveImage: (UIImage*)image | |
{ | |
if (image != nil) | |
{ | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, | |
NSUserDomainMask, YES); | |
NSString *documentsDirectory = [paths objectAtIndex:0]; | |
NSString* path = [documentsDirectory stringByAppendingPathComponent: | |
[NSString stringWithString: @"test.png"] ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UXAppDelegate.m | |
// Dispatch_queue | |
// | |
// Created by wang keke on 13-3-11. | |
// Copyright (c) 2013年 uxin. All rights reserved. | |
// | |
#import "UXAppDelegate.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ______ ______ ______ | |
// /\ __ \ /\ ___\ /\ ___\ | |
// \ \ __< \ \ __\_ \ \ __\_ | |
// \ \_____\ \ \_____\ \ \_____\ | |
// \/_____/ \/_____/ \/_____/ | |
// | |
// Copyright (c) 2012 BEE creators | |
// http://www.whatsbug.com | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UIView+DEFrameAdditions.h | |
// | |
// Copyright (c) 2011-2013 Double Encore, Inc. All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer | |
// in the documentation and/or other materials provided with the distribution. Neither the name of the Double Encore Inc. nor the names of its | |
// contributors may be used to endorse or promote products derived from this software without specific prior written permission. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if NS_BLOCKS_AVAILABLE | |
typedef void (^CompletionBlock)(NSString* result); | |
typedef void (^FailedBlock)(NSError* error); | |
#endif | |
@interface ImageUploader : NSObject { | |
NSData *theImage; | |
CompletionBlock completeblock; | |
FailedBlock failedblock; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//将版本字符串转换为数字 | |
+(int)getVersionNumber:(NSString*)version | |
{ | |
int versionNo = 0; | |
NSArray *arr = [version componetsSeparateByString:@"."]; | |
int count = arr.count; | |
for(NSString *no in arr) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//去掉group cell的边框 | |
UIView *tempView = [[[UIView alloc] init] autorelease]; | |
[self.photoCell setBackgroundView:tempView]; | |
[self.photoCell setBackgroundColor:[UIColor clearColor]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSDate (Between) | |
- (BOOL)isBetweenDate:(NSDate*)beginDate andDate:(NSDate*)endDate; | |
- (BOOL)isEarlyThanDate:(NSDate*)date; | |
- (BOOL)isLaterThanDate:(NSDate*)date; | |
@end |
OlderNewer