This file contains 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 ([[str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length]<=0) { | |
} |
This file contains 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
NSString* keysPressed = [theEvent characters]; | |
if ( [keysPressed isEqualToString:@" "] ) | |
{ | |
if(theEvent.type==NSKeyDown) | |
NSLog(@"spaceDown"); | |
if(theEvent.type==NSKeyUp) | |
NSLog(@"spaceUp"); | |
} |
This file contains 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
BOOL bo = [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:nil]; | |
bo ? : NSLog(@"创建失败"); |
This file contains 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
/** | |
Returns the path to the application's documents directory. | |
*/ | |
- (NSString *)applicationDocumentsDirectory { | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; | |
return basePath; | |
} |
This file contains 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
+ (AppDelegate *)sharedAppDelegate { | |
return (AppDelegate *)[[UIApplication sharedApplication] delegate]; | |
} |
This file contains 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
AFHTTPRequestOperation * operation = [_AFManager POST:[_baseURL stringByAppendingString:MCSetavatarInterface] parameters:dic constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { | |
[formData appendPartWithFileURL:[dic objectForKey:@"url"] name:@"avatar" error:nil]; | |
} success:^(AFHTTPRequestOperation *operation, id responseObject) { | |
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { | |
}]; |
This file contains 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
1、 三角函数 | |
double sin (double);正弦 | |
double cos (double);余弦 | |
double tan (double);正切 | |
2 、反三角函数 | |
double asin (double); 结果介于[-PI/2, PI/2] | |
double acos (double); 结果介于[0, PI] | |
double atan (double); 反正切(主值), 结果介于[-PI/2, PI/2] | |
double atan2 (double, double); 反正切(整圆值), 结果介于[-PI, PI] | |
3 、双曲三角函数 |
This file contains 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
//绘制三角 | |
- (void)drawRect:(CGRect)rect | |
{ | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextBeginPath(context); | |
CGContextMoveToPoint (context, CGRectGetMinX(rect), CGRectGetMaxY(rect)); | |
CGContextAddLineToPoint(context, CGRectGetMidX(rect), CGRectGetMinY(rect)); | |
CGContextAddLineToPoint(context, CGRectGetMaxX(rect), CGRectGetMaxY(rect)); | |
CGContextClosePath(context); |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
NSDate *date = [NSDate date]; | |
// 调整8小时时差 | |
NSTimeZone *zone = [NSTimeZone systemTimeZone]; | |
NSInteger interval = [zone secondsFromGMTForDate:date]; | |
NSDate *localeDate = [date dateByAddingTimeInterval: interval]; |
OlderNewer