您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
02 買粉絲怎么制作橫屏長圖文(升級ios9后買粉絲買粉絲打開怎么自動成橫屏)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-14 05:12:04【】2人已围观
简介@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
很赞哦!(294)
相关文章
- 01 美國對外貿易總額排名(美國2021年國民生產總值)
- 01 美團訂閱短視頻領現金怎么關閉(美團訂閱短視頻要錢嗎)
- 01 美國明星直播帶貨嗎(現在明星直播已成趨勢,為什么明星那么有錢還要直播帶貨?)
- 03 廈門玖竹貿易有限公司(我身體的經路痛什么地方好看)
- 03 廈門順潤貿易有限公司(廈門有那些大集團)
- 03 廈門升洋貿易有限公司(臺灣近代歷史)
- 01 美國最新貿易政策(2016年美國的貿易政策是什么)
- 01 美國對外貿易總額歷年數據(2006年我國對外貿易總額和外匯儲備世界排名是??)
- 03 廈門海匯豐進出口貿易有限公司(匯豐銀行是哪個國家的??)
- 03 原油貿易公司經營范圍(中石油、中石化、中海油三者的區別、經營范圍和隸屬關系)
热门文章
站长推荐
03 去買菜被粉絲認出來(去買菜沒人敢賣,坐出租車沒人敢載,影帝王雙寶的演技有多逼真?)
03 廈門工學院和外語外貿(福建民辦二本學校排名一覽表)
03 廈門市洋宇貿易發展有限公司招聘(急!有誰知道2008年12月14日廈門大學招聘會企業詳細名單?)
03 去海南做進出口貿易好嗎(家里有親戚介紹去海南做生意,說是投入十幾萬,然后在里面上班,年底就分紅數目很可觀,請問這是傳銷嗎)
01 美國在海外駐軍有哪些基地(美國在亞洲的軍事基地?)
03 廈門櫻布貿易有限公司(誰布櫻裙子被衣柜夾住那個啥號是什么?)
03 廈門一恒貿易有限公司(廈門房地產開發商排名)
01 美國為什么要收購tiktok(國外版抖音賣給美國了嗎 TikTok為什么要賣給美國企業)