Skip to content

Instantly share code, notes, and snippets.

View jebai0521's full-sized avatar
🎯
Focusing

Chen Ming jebai0521

🎯
Focusing
View GitHub Profile
CATransition* transition = [CATransition animation];
transition.duration = 0.4;
transition.type = kCATransitionFade;
transition.subtype = kCATransitionFromBottom;
[self.navigationController.view.layer addAnimation:transition forKey:kCATransition];
[self.navigationController pushViewController:adjustViewController animated:NO];
pixelmator
http://help.pixelmator.com/#118
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for(indFamily=0;indFamily<[familyNames count];++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames =[[NSArray alloc]initWithArray:[UIFont fontNamesForFamilyName:[familyNames objectAtIndex:indFamily]]];
for(indFont=0; indFont<[fontNames count]; ++indFont)
{
NSLog(@" Font name: %@",[fontNames objectAtIndex:indFont]);
因为播放器只支持播放NSURL参数的资源,所以要播放本地文件时,需要将路径参数转化为
本地路径构造URL,使用NSURL 提供的静态方法fileURLWithPath
Creating an NSURL
– initWithScheme:host:path:
+ URLWithString:
– initWithString:
+ URLWithString:relativeToURL:
– initWithString:relativeToURL:
+ fileURLWithPath:isDirectory:
1. 安装Ubuntu Server版本
2. 更新软件源
sudo apt-get update
3. 安装open-ssh
sudo apt-get install openssh-server
4. 提升ssh认証时间
BOOL isCameraValid = YES;
//判断iOS7的宏,没有就自己写个,下边的方法是iOS7新加的,7以下调用会报错
if(isIOS7AndLater)
{
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (authStatus != AVAuthorizationStatusAuthorized)
{
isCameraValid = NO;
}
}
[self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue] withHandler:^(CMDeviceMotion *motion,NSError *error){
double gravityX = motion.gravity.x;
double gravityY = motion.gravity.y;
double gravityZ = motion.gravity.z;
NSLog(@"gravityX = %f",gravityX);
NSLog(@"gravityY = %f",gravityY);
#import <CommonCrypto/CommonDigest.h>
- (NSString *)md5HexDigest:(NSString*)password
{
const char *original_str = [password UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(original_str, strlen(original_str), result);
NSMutableString *hash = [NSMutableString string];
for (int i = 0; i < 16; i++)
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
btn.contentHorizontalAlignment = UIControlContentHorizonAlignmentLeft;