您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
02 買粉絲買粉絲獲取位置失敗ios(為什么iOS 10 下無法自動獲取精確定位)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-07-08 15:28:06【】4人已围观
简介/p>//用于切換的兩個ViewIBOutletUIView*landscape;IBOutletUIView*portrait;//Foo兩個View中的Foo按鈕IBOutletUIButton*
//用于切換的兩個View
IBOutlet UIView *landscape;
IBOutlet UIView *portrait;
//Foo兩個View中的Foo按鈕
IBOutlet UIButton *landscapeFooButton;
IBOutlet UIButton *portraitFooButton;
//Bar兩個View中的Bar按鈕
IBOutlet UIButton *landscapeBarButton;
IBOutlet UIButton *portraitBarButton;
還需要File's Owner和兩個View想關聯。按住Ctrl將File's Owner拖到Portrait上面,在彈出灰色菜單上選擇Portrait同理選擇Landscape。然后在按住Ctrl將File's Owner拖到Landscape上面,在彈出的灰色菜單上選擇View,讓Landscape為自啟動View。
然后是方法的實現:
-(void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)to ration:(NSTimeInterval)ration
{
if(to == UIInterfaceOrientationPortrait)
{
self.view = self.portrait;
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation(degressToRadian(0));
self.view.bounds = CGRectMake(0.0, 0.0, 320.0, 460.0);
}
else if (to == UIInterfaceOrientationLandscapeLeft)
{
self.view = self.landscape;
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation(degressToRadian(-90));
self.view.bounds = CGRectMake(0.0, 0.0, 460.0, 320.0);
}
else if (to == UIInterfaceOrientationPortraitUpsideDown)
{
self.view = self.portrait;
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation(degressToRadian(180));
self.view.bounds = CGRectMake(0.0, 0.0, 320.0, 460.0);
}
else if (to == UIInterfaceOrientationLandscapeRight)
{
self.view = self.landscape;
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation(degressToRadian(90));
self.view.bounds = CGRectMake(0.0, 0.0, 460.0, 320.0);
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
不要忘了在dealloc中釋放資源哦。
因為在上面的代碼中使用到了Core Graphics框架,因此要把該框架連接到該項目中,具體的方法是:在Resources上面點右鍵Add->Existing Frameworks。然后就是查找路徑了。我第一次就看錯了沒有找到,哎,做事情不下心呀!具體路徑為:/Developer/Platforms /iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System /Library/Frameworks/CoreGraphics.framework 呵呵,這個路徑是有點長不好找,記住不是在:/Developer/SDKs里面了,我剛開始就是找到呢里面了。呵呵!還有就是導入后會處理一個提示框, 不要Copy,Reference Type要選擇Relative to Current SDK然后add就OK了。
例子中還有一個方法是對View中的按鈕實現隱藏的,這個就比較簡單了!
具體方法為:
-(IBAction)buttonPressed:(id)sender
{
if(sender == portraitFooButton||sender == landscapeFooButton)
{
portraitFooButton.hidden=YES;
landscapeFooButton.hidden=YES;
}
else
{
portraitBarButton.hidden=YES;
landscapeBarButton.hidden=YES;
}
}
呵呵,上圖兩張看看:
剛開始運行時的圖片
旋轉后并且按了Foo按鈕后的圖片
很赞哦!(52927)
相关文章
- 05 體育節買粉絲文章(學校社會實踐工作總結范文5篇)
- 05 佛山市順德區振興貿易有限公司(中國制鞋企業排行榜)
- 05 佛山幫粉絲買寵物(余少群孫耀琦什么關系)
- 05 優秀的外貿業務員總結(外貿業務員的自我總結報告)
- 01 外貿助理工作內容(外貿業務助理工作的主要內容是什么?)
- 05 佛山市興勇合貿易有限公司(那位大哥知道江浙滬廣州這四個地方潤滑油生產廠家有哪些?請詳細點,謝謝!)
- 05 傳統外貿符合相關規定可以辦理出口退稅(收到出口退稅款時之后發現單證不齊,視同內銷,需補回退稅款并交稅的所有會計分錄)
- 01 外貿單證全套單據制作答案(求2011年6月國際商務單證員考試繕制與操作真題試題及答案)
- 05 位于市區的某外貿公司(廣州市區是哪幾個區)
- 01 外貿單證操作第五版(急求:《國際貿易與國際金融》下列答案)