版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、獲取系統(tǒng)語言設(shè)置NSUserDefaults*userDefault=[NSUserDefaultsstandardUserDefaults];NSArray*languages=[userDefaultobjectForKey:@"AppleLanguages"];NSString*preferredLang=[languagesobjectAtIndex:0];2、緩存路徑下文件大小-(unsignedlonglongint)cacheFolderSize{NSFileManager*_manager=[NSFileManagerdefaultManager];NSArray*_cachePaths=NSSearchPathForDirectoriesInDomains(NSCachesDirectory,
NSUserDomainMask,YES);NSString*_cacheDirectory=[_cachePathsobjectAtIndex:];NSArray*_cacheFileList;NSEnumerator*_cacheEnumerator;NSString*_cacheFilePath;unsignedlonglongint_cacheFolderSize=;_cacheFileList=[_managersubpathsAtPath:_cacheDirectory];_cacheEnumerator=[_cacheFileListobjectEnumerator];while(_cacheFilePath=[_cacheEnumeratornextObject]){NSDictionary*_cacheFileAttributes=[_managerfileAttributesAtPath:[_cacheDirectorystringByAppendingPathComponent:_cacheFilePath]traverseLink:YES];_cacheFolderSize+=[_cacheFileAttributesfileSize];}//單位是字節(jié)return_cacheFolderSize;}3、Popoverpush時(shí)Frame無法改變解決辦法在popover中的ViewController中實(shí)現(xiàn):-(void)viewWillAppear:(BOOL)animated
{CGSizesize=CGSizeMake(320,480);//sizeofviewinpopoverself.contentSizeForViewInPopover=size;[superviewWillAppear:animated];}4、tableview滑動(dòng)導(dǎo)致NSTimer和委托回調(diào)停止解決辦法//請求回調(diào)NSURLRequest*請求=...scheduleInRunLoop:[NSRunLoopcurrentRunLoop]
forMode:NSRunLoopCommonModes]
[連接開始]//定時(shí)器回調(diào)NSTimer*updateTimer=[NSTimerscheduledTimerWithTimeInterval:0.01f目標(biāo):自我選擇:選擇(updatePencent)的UserInfo:無重復(fù):是];*NSRunLoop主要=[NSRunLoopcurrentRunLoop]
[主要addTimer:updateTimerforMode:NSRunLoopCommonModes];5、手勢識別類UIGestureRecognizer6、SFHFKeychainUtils存儲信息蘋果SDK自帶的就有密碼保護(hù),使用方法很簡單,如下:1、引入Security.frameWork框架。2、引入頭文件:SFHKeychainUtils.h.3、存密碼:[SFHFKeychainUtilsstoreUsername:@"dd"andPassword:@"aa"forServiceName:SERVICE_NAMEupdateExisting:1error:nil];[SFHFKeychainUtilsdeleteItemForUsername:@"dd"andServiceName:SERVICE_NAMEerror:nil];4、取密碼:NSString*passWord=[SFHFKeychainUtilsgetPasswordForUsername:@"dd"andServiceName:SERVICE_NAMEerror:nil];7、missingrequiredarchitecturei386infile解決辦法在TargetInfo里面修改FrameworkSearchPasths刪除里面內(nèi)容就可以了。8、view放大縮小動(dòng)畫效果//創(chuàng)建縮小了的視圖
myWeiBoImageVC=[[UIViewControlleralloc]init];
myWeiBoImageVC.view.clipsToBounds=YES;
myWeiBoImageVC.view.alpha=0.0;
myWeiBoImageVC.view.frame=CGRectMake(64,0,1024-64,768-20);
[self.viewaddSubview:myWeiBoImageVC.view];
CGAffineTransformnewTransform=
CGAffineTransformScale(myWeiBoImageVC.view.transform,0.1,0.1);
[myWeiBoImageVC.viewsetTransform:newTransform];
myWeiBoImageVC.view.center=CGPointMake(670,100);
[selfperformSelector:@selector(imageViewControllerBigAnimation)];
//放大剛剛創(chuàng)建縮小后的視圖
-(void)imageViewControllerBigAnimation{
[UIViewbeginAnimations:@"imageViewBig"context:nil];
[UIViewsetAnimationDuration:0.5];
CGAffineTransformnewTransform=CGAffineTransformConcat(myWeiBoImageVC.view.transform,CGAffineTransformInvert(myWeiBoImageVC.view.transform));
[myWeiBoImageVC.viewsetTransform:newTransform];
myWeiBoImageVC.view.alpha=1.0;
myWeiBoImageVC.view.center=CGPointMake(416,510);
[UIViewcommitAnimations];
}
//縮小視圖隱藏
-(void)imageViewControllerSmallAnimation{
[UIViewbeginAnimations:@"imageViewSmall"context:nil];
[UIViewsetAnimationDuration:0.5];
CGAffineTransformnewTransform=CGAffineTransformScale(myWeiBoImageVC.view.transform,0.1,0.1);
[myWeiBoImageVC.viewsetTransform:newTransform];
myWeiBoImageVC.view.center=CGPointMake(670,100);
[UIViewcommitAnimations];
}9、UIScrollView控制View縮放allImageScrollView=[[UIScrollViewalloc]initWithFrame:CGRectMake(0,0,768,1024)];
allImageScrollView.minimumZoomScale=0.3;
allImageScrollView.maximumZoomScale=1.0;
allImageScrollView.backgroundColor=[UIColorclearColor];
allImageScrollView.delegate=self;
[self.viewaddSubview:allImageScrollView];
mPicStatusesViewController=[[PicStatusesViewControlleralloc]init];
[allImageScrollViewaddSubview:mPicStatusesViewController.view];
//UIScrollViewDelegete實(shí)現(xiàn)
-(UIView*)viewForZoomingInScrollView:(UIScrollView*)scrollView{
returnmPicStatusesViewController.view;//返回ScrollView上添加的需要縮放的視圖
}
-(void)scrollViewDidZoom:(UIScrollView*)scrollView{
//縮放操作中被調(diào)用
}
-(void)scrollViewDidEndZooming:(UIScrollView*)scrollViewwithView:(UIView*)viewatScale:(float)scale{
//縮放結(jié)束后被調(diào)用
}10、iOS3.2播放視頻NSString*urlString=[NSStringstringWithString:@"視頻url"];NSURL*movieUrl=[[NSURLalloc]initWithString:urlString];
MPMoviePlayerController*myMoviePlayer=[[MPMoviePlayerControlleralloc]initWithContentURL:movieUrl];
myMoviePlayer.view.frame=CGRectMake(250,250,350,350);
[self.viewaddSubview:myMoviePlayer.view];
myMoviePlayer.shouldAutoplay=YES;
myMoviePlayer.scalingMode=MPMovieScalingModeAspectFit;
[myMoviePlayerplay];11、谷歌地圖翻起動(dòng)畫效果CATransition*animation=[CATransitionanimation];
[animationsetDelegate:self];
[animationsetDuration:0.35];
[animationsetTimingFunction:UIViewAnimationCurveEaseInOut];
if(!curled){animation.type=@"pageCurl";
animation.fillMode=kCAFillModeForwards;
animation.endProgress=0.40;
}else{
animation.type=@"pageUnCurl";
animation.fillMode=kCAFillModeBackwards;
animation.startProgress=0.30;
}
[animationsetRemovedOnCompletion:NO];
[self.viewexchangeSubviewAtIndex:0withSubviewAtIndex:1];
[self.view.layeraddAnimation:animationforKey:@"pageCurlAnimation"];12、給View添加陰影和邊框UIImageView*imgvPhoto=[UIImageViewalloc]init];
//添加邊框
CALayer*layer=[_imgvPhotolayer];
layer.borderColor=[[UIColorwhiteColor]CGColor];
layer.borderWidth=5.0f;
//添加四個(gè)邊陰影
_imgvPhoto.layer.shadowColor=[UIColorblackColor].CGColor;
_imgvPhoto.layer.shadowOffset=CGSizeMake(0,0);
_imgvPhoto.layer.shadowOpacity=0.5;
_imgvPhoto.layer.shadowRadius=10.0;
//添加兩個(gè)邊陰影
_imgvPhoto.layer.shadowColor=[UIColorblackColor].CGColor;
_imgvPhoto.layer.shadowOffset=CGSizeMake(4,4);
_imgvPhoto.layer.shadowOpacity=0.5;
_imgvPhoto.layer.shadowRadius=2.0;13、使用NSTimer與UIView動(dòng)畫實(shí)現(xiàn)飄雪效果viewDidLoad事件中,增加一個(gè)圖片及定時(shí)器并啟動(dòng),這里的pic請?jiān)陬^文件中定義。-(void)viewDidLoad{
[superviewDidLoad];
self.pic=[UIImageimageNamed:@"snow.png"];//初始化圖片
//啟動(dòng)定時(shí)器,實(shí)現(xiàn)飄雪效果
[NSTimerscheduledTimerWithTimeInterval:(0.2)target:selfselector:@selector(ontime)userInfo:nilrepeats:YES];
}然后再實(shí)現(xiàn)定時(shí)器定時(shí)調(diào)用的ontime方法:
-(void)ontime{
UIImageView*view=[[UIImageViewalloc]initWithImage:pic];//聲明一個(gè)UIImageView對象,用來添加圖片
view.alpha=0.5;//設(shè)置該view的alpha為0.5,半透明的
intx=round(random()20);//隨機(jī)得到該圖片的x坐標(biāo)
inty=round(random()20);//這個(gè)是該圖片移動(dòng)的最后坐標(biāo)x軸的
ints=round(random())+10;//這個(gè)是定義雪花圖片的大小
intsp=1/round(random()0)+1;//這個(gè)是速度
view.frame=CGRectMake(x,-50,s,s);//雪花開始的大小和位置
[self.viewaddSubview:view];//添加該view
[UIViewbeginAnimations:nilcontext:view];//開始動(dòng)畫
[UIViewsetAnimationDuration:10*sp];//設(shè)定速度
view.frame=CGRectMake(y,500,s,s);//設(shè)定該雪花最后的消失坐標(biāo)
[UIViewsetAnimationDelegate:self];
[UIViewcommitAnimations];
}14、配置Xcode看程序崩潰信息1、在xcode中的左側(cè)目錄中找到Executables打開2、雙擊和工程名一樣的文件。3、在打開的文件中的Arguments選項(xiàng),在下面的框中加入Name:NSZombieEnabled設(shè)置value為YES。15、程序中發(fā)送郵件和檢測設(shè)備郵箱是否被配置-(void)addEmail{ClassmailClass=(NSClassFromString(@"MFMailComposeViewController"));if(mailClass!=nil){if([mailClasscanSendMail]){[selfdisplayComposerSheet];}else{[selflaunchMailAppOnDevice];}}else{[selflaunchMailAppOnDevice];}}-(void)displayComposerSheet{MFMailComposeViewController*controller=[[MFMailComposeViewControlleralloc]init];controller.navigationBar.tag=1002;[self.navigationController.navigationBarsetNeedsDisplay];controller.mailComposeDelegate=self;[controllersetSubject:@"意見反饋"];[controllersetToRecipients:[[NSArrayalloc]initWithObjects:@"555@",nil]];NSString*emailBody=nil;[controllersetMessageBody:emailBodyisHTML:YES];[selfpresentModalViewController:controlleranimated:YES];[controllerrelease];}#pragmamarkmailComposeDelegate(void)mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult:(MFMailComposeResult)resulterror:(NSError*)error{if(result==MFMailComposeResultSent){[selfdismissModalViewControllerAnimated:YES];}if(result==MFMailComposeResultSaved){[selfdismissModalViewControllerAnimated:YES];}if(result==MFMailComposeResultFailed){Emailalert=[[UIAlertViewalloc]initWithTitle:@""message:@"發(fā)送失敗"delegate:se
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年網(wǎng)絡(luò)空間道德與法治教育試題含答案
- 所有分類新概念武器
- 2026年劇本殺運(yùn)營公司音效燈光操控員崗位職責(zé)管理制度
- 2026年劇本殺運(yùn)營公司實(shí)習(xí)生管理與培養(yǎng)制度
- 產(chǎn)褥期飲食營養(yǎng)指導(dǎo)要點(diǎn)
- 高中生個(gè)性化學(xué)習(xí)成果認(rèn)證中區(qū)塊鏈與人工智能技術(shù)的融合創(chuàng)新研究教學(xué)研究課題報(bào)告
- 2025年新型瓜子口味創(chuàng)新市場分析
- 初中英語寫作中情感邏輯銜接詞使用頻率統(tǒng)計(jì)課題報(bào)告教學(xué)研究課題報(bào)告
- 區(qū)域特殊教育均衡發(fā)展中的人工智能康復(fù)技術(shù)應(yīng)用案例研究教學(xué)研究課題報(bào)告
- 智能精準(zhǔn)教研對教師教育科研能力提升的實(shí)踐探索與效果評價(jià)教學(xué)研究課題報(bào)告
- 2024年四川省考公務(wù)員考試結(jié)構(gòu)化面試鄉(xiāng)鎮(zhèn)崗真題試題試卷答案解析
- 航天智能通信原理與應(yīng)用 課件 第7章 電磁頻譜感知
- 護(hù)理節(jié)前安全教育
- 2025年上半年遼寧大連市總工會(huì)面向社會(huì)招聘社會(huì)化工會(huì)工作者42人重點(diǎn)基礎(chǔ)提升(共500題)附帶答案詳解
- 個(gè)人委托書范本模板電子版
- 租學(xué)位合同協(xié)議書
- NB-T32036-2017光伏發(fā)電工程達(dá)標(biāo)投產(chǎn)驗(yàn)收規(guī)程
- 國有企業(yè)采購管理規(guī)范 T/CFLP 0027-2020
- 模板-健康風(fēng)險(xiǎn)評估報(bào)告
- (正式版)HGT 20593-2024 鋼制化工設(shè)備焊接與檢驗(yàn)工程技術(shù)規(guī)范
- 肘關(guān)節(jié)恐怖三聯(lián)征
評論
0/150
提交評論