好程序员-ios开发小知识点

上传人:橙** 文档编号:333370665 上传时间:2022-09-01 格式:PDF 页数:9 大小:121.51KB
返回 下载 相关 举报
好程序员-ios开发小知识点_第1页
第1页 / 共9页
好程序员-ios开发小知识点_第2页
第2页 / 共9页
好程序员-ios开发小知识点_第3页
第3页 / 共9页
好程序员-ios开发小知识点_第4页
第4页 / 共9页
好程序员-ios开发小知识点_第5页
第5页 / 共9页
亲,该文档总共9页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《好程序员-ios开发小知识点》由会员分享,可在线阅读,更多相关《好程序员-ios开发小知识点(9页珍藏版)》请在金锄头文库上搜索。

1、1、获取系统语言设置NSUserDefaults*userDefault=NSUserDefaults standardUserDefaults;NSArray*languages=userDefault objectForKey:AppleLanguages;NSString*preferredLang=languages objectAtIndex:0;2、缓存路径下文件大小-(unsigned long long int)cacheFolderSize NSFileManager*_manager=NSFileManager defaultManager;NSArray*_cachePa

2、ths=NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES);NSString*_cacheDirectory=_cachePaths objectAtIndex:;NSArray*_cacheFileList;NSEnumerator*_cacheEnumerator;NSString*_cacheFilePath;unsigned long long int _cacheFolderSize=;_cacheFileList=_manager subpathsAtPath:_cacheDirec

3、tory;_cacheEnumerator=_cacheFileList objectEnumerator;while(_cacheFilePath=_cacheEnumerator nextObject)NSDictionary*_cacheFileAttributes=_managerfileAttributesAtPath:_cacheDirectory stringByAppendingPathComponent:_cacheFilePath traverseLink:YES;_cacheFolderSize+=_cacheFileAttributes fileSize;/单位是字节r

4、eturn _cacheFolderSize;3、Popover push 时 Frame 无法改变解决办法在 popover 中的 ViewController中实现:-(void)viewWillAppear:(BOOL)animated CGSize size=CGSizeMake(320,480);/size of view in popover 名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 9 页 -self.contentSizeForViewInPopover=size;super viewWillAppear:animated;4、tableview滑动导致 N

5、STimer 和委托回调停止解决办法/请求回调NSURLRequest*请求=.scheduleInRunLoop:NSRunLoop currentRunLoop forMode:NSRunLoopCommonModes 连接开始 /定时器回调NSTimer*updateTimer=NSTimer scheduledTimerWithTimeInterval:0.01f 目标:自我选择:选择(updatePencent)的 UserInfo:无重复:是;*NSRunLoop主要=NSRunLoop currentRunLoop 主要 addTimer:updateTimer forMode:

6、NSRunLoopCommonModes;5、手势识别类UIGestureRecognizer 6、SFHFKeychainUtils 存储信息苹果 SDK 自带的就有密码保护,使用方法很简单,如下:1、引入 Security.frameWork框架。2、引入头文件:SFHKeychainUtils.h.3、存密码:SFHFKeychainUtils storeUsername:dd andPassword:aaforServiceName:SERVICE_NAMEupdateExisting:1 error:nil;SFHFKeychainUtils deleteItemForUsernam

7、e:dd andServiceName:SERVICE_NAME error:nil;4、取密码:NSString*passWord=SFHFKeychainUtils getPasswordForUsername:ddandServiceName:SERVICE_NAMEerror:nil;7、missing required architecture i386 in file 解决办法在 TargetInfo里面修改Framework Search Pasths 删除里面内容就可以了。8、view 放大缩小动画效果名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 9 页 -/创

8、建缩小了的视图myWeiBoImageVC=UIViewController alloc init;myWeiBoImageVC.view.clipsToBounds=YES;myWeiBoImageVC.view.alpha=0.0;myWeiBoImageVC.view.frame=CGRectMake(64,0,1024-64,768-20);self.view addSubview:myWeiBoImageVC.view;CGAffineTransform newTransform=CGAffineTransformScale(myWeiBoImageVC.view.transform

9、,0.1,0.1);myWeiBoImageVC.view setTransform:newTransform;myWeiBoImageVC.view.center=CGPointMake(670,100);self performSelector:selector(imageViewControllerBigAnimation);/放大刚刚创建缩小后的视图-(void)imageViewControllerBigAnimation UIView beginAnimations:imageViewBig context:nil;UIView setAnimationDuration:0.5;C

10、GAffineTransform newTransform=CGAffineTransformConcat(myWeiBoImageVC.view.transform,CGAffineTransformInvert(myWeiBoImageVC.view.transform);myWeiBoImageVC.view setTransform:newTransform;myWeiBoImageVC.view.alpha=1.0;myWeiBoImageVC.view.center=CGPointMake(416,510);UIView commitAnimations;/缩小视图隐藏-(void

11、)imageViewControllerSmallAnimation UIView beginAnimations:imageViewSmall context:nil;UIView setAnimationDuration:0.5;名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 9 页 -CGAffineTransform newTransform=CGAffineTransformScale(myWeiBoImageVC.view.transform,0.1,0.1);myWeiBoImageVC.view setTransform:newTransform;myWeiBoI

12、mageVC.view.center=CGPointMake(670,100);UIView commitAnimations;9、UIScrollView 控制 View 缩放allImageScrollView=UIScrollView alloc initWithFrame:CGRectMake(0,0,768,1024);allImageScrollView.minimumZoomScale=0.3;allImageScrollView.maximumZoomScale=1.0;allImageScrollView.backgroundColor=UIColor clearColor;

13、allImageScrollView.delegate=self;self.view addSubview:allImageScrollView;mPicStatusesViewController=PicStatusesViewController alloc init;allImageScrollView addSubview:mPicStatusesViewController.view;/UIScrollView Delegete 实现-(UIView*)viewForZoomingInScrollView:(UIScrollView*)scrollView return mPicSt

14、atusesViewController.view;/返回 ScrollView 上添加的需要缩放的视图-(void)scrollViewDidZoom:(UIScrollView*)scrollView /缩放操作中被调用-(void)scrollViewDidEndZooming:(UIScrollView*)scrollView withView:(UIView*)view atScale:(float)scale /缩放结束后被调用 名师资料总结-精品资料欢迎下载-名师精心整理-第 4 页,共 9 页 -10、iOS3.2 播放视频NSString*urlString=NSString

15、 stringWithString:视频 url;NSURL*movieUrl=NSURL alloc initWithString:urlString;MPMoviePlayerController*myMoviePlayer=MPMoviePlayerController alloc initWithContentURL:movieUrl;myMoviePlayer.view.frame=CGRectMake(250,250,350,350);self.view addSubview:myMoviePlayer.view;myMoviePlayer.shouldAutoplay=YES;m

16、yMoviePlayer.scalingMode=MPMovieScalingModeAspectFit;myMoviePlayer play;11、谷歌地图翻起动画效果CATransition*animation=CATransition animation;animation setDelegate:self;animation setDuration:0.35;animation setTimingFunction:UIViewAnimationCurveEaseInOut;if(!curled)animation.type=pageCurl;animation.fillMode=kCAFillModeForwards;animation.endProgress=0.40;else animation.type=pageUnCurl;animation.fillMode=kCAFillModeBackwards;animation.startProgress=0.30;animation setRemovedOnCompletion:NO;self.view exchangeSu

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 初中教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号