您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
02 買粉絲怎么制作橫屏長圖文(買粉絲怎么制作橫屏長圖文)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-05-29 02:36:12【】9人已围观
简介@synthesizebutton3;@synthesizebutton4;@synthesizebutton5;@synthesizebutton6;-(void)willAnimateSe買粉絲n
@synthesize button3;
@synthesize button4;
@synthesize button5;
@synthesize button6;
-(void)willAnimateSe買粉絲ndHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation ration:(NSTimeInterval)ration
{
UIInterfaceOrientation to=self.interfaceOrientation;
if(to == UIInterfaceOrientationPortrait || to == UIInterfaceOrientationPortraitUpsideDown)
{
button1.frame = CGRectMake(20, 20, 125, 125);
button2.frame = CGRectMake(175, 20, 125, 125);
button3.frame = CGRectMake(20, 168, 125, 125);
button4.frame = CGRectMake(175, 168, 125, 125);
button5.frame = CGRectMake(20, 315, 125, 125);
button6.frame = CGRectMake(175, 315, 125, 125);
}
else
{
button1.frame = CGRectMake(20, 20, 125, 125);
button2.frame = CGRectMake(20, 155, 125, 125);
button3.frame = CGRectMake(177, 20, 125, 125);
button4.frame = CGRectMake(177, 155, 125, 125);
button5.frame = CGRectMake(328, 20, 125, 125);
button6.frame = CGRectMake(328, 155, 125, 125);
}
}
還需要修改- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation的代碼:
修改后為:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait
|| interfaceOrientation == UIInterfaceOrientationLandscapeLeft
|| interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
然后在dealloc中釋放資源:
- (void)dealloc
{
[button1 release];
[button2 release];
[button3 release];
[button4 release];
[button5 release];
[button6 release];
[super dealloc];
}
到此代碼部分搞定,然后就是連接控制器和視圖了。這點應該比較簡單了。呵呵!
然后Build and Go最終結果為:
3.切換視圖
這種方法使用于比較復雜的界面,是需要分別設計橫向模式和縱向模式,然后在使用的過程中自動切換。
當然了這個也需要確定輸出口和一些方法了。
首先定義輸出口:
(簡單描述,設計兩個視圖,一個定義為landscape,一個是portrait,一個為320x460,一個為480x300,每一個輸出口分別和每個視圖中的按鈕想關聯)
//用于切換的兩個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
很赞哦!(1434)
相关文章
- 01 蘋果訂閱美國日歷鏈接(蘋果手機添加日歷鏈接)
- 03 youtube music download mp3 juice mp3 買粉絲(怎樣下載音樂到手機?)
- 03 youtube music app windows download文件名(今日新聞淺談:Youtube Music 也加入串流音樂服務大混戰)
- 03 youtube music 買粉絲 download app 買粉絲 post(如何在youtubemusic中創建快捷指令)
- 03 youtube music download mp3 買粉絲 mp3 my買粉絲mp3(有沒有不用會員也能聽音樂的軟件?)
- 01 蘋果訂閱服務取消不了怎么辦(蘋果手機為什么取消不了訂閱服務)
- 03 youtube music app download windows embeddable package和windows11哪個好(安裝pycharm專業版出現已殺死)
- 03 youtube music download 買粉絲 for pc download 買粉絲(幫忙翻譯一段IPHONE廣告)
- 01 蘋果訂閱的賬單在哪里查看(蘋果手機扣款在哪里看)
- 03 youtube music download windows 10 english version browser(學習英語的十個方法,用英語回答,有哪些?)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款的名片
职业:程序员,设计师
现居:黑龙江省大庆肇源县
工作室:小组
Email:[email protected]
热门文章
站长推荐
01 蘋果訂閱怎么打開(怎么查看蘋果付費訂閱)
01 蘋果訂閱日本日歷url鏈接(怎么把url導入蘋果日歷)
03 youtube music app pc download 買粉絲全功能(有沒有抖音剪輯培訓教程,還有抖音書單培訓教程,書單文案如何原創?)
01 蘋果訂閱騰訊會員是哪個賬號(蘋果商店里訂閱的騰訊會員怎么看綁定的賬號?)
03 youtube music 買粉絲 80s music radio(杰西麥卡特尼Jesse McCartney 資料)
03 youtube music app pc download 買粉絲下載(如何讓YTmusic在后臺播放)
03 youtube music download pc mp3 player online(今日新聞淺談:Youtube Music 也加入串流音樂服務大混戰)
01 蘋果訂閱服務在哪看(蘋果手機設置訂閱服務在哪里)