您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
02 ios買粉絲怎么放到桌面(蘋果手機的買粉絲筆記是怎么用)
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-07-19 06:49:19【】6人已围观
简介tton3.frame=CGRectMake(20,168,125,125);button4.frame=CGRectMake(175,168,125,125);button5.frame=CGRec
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.hidden=YES;
landscapeBarButton.hidden=YES;
}
}
呵呵,上圖兩張看看:
剛開始運行時的圖片
旋轉后并且按了Foo按鈕后的圖片
買粉絲買粉絲推送消息的封面圖片,ios無法顯示,Android顯示正常。
問題已經解決!把圖片名稱改成英文,如果還不行,就把圖片路徑下的中文全換成英文!
很赞哦!(64832)
相关文章
- 03 新加坡的海外大學分校(英國格林多大學新加坡分校是什么?)
- 01 家長開放日買粉絲文章(老師如何給家長反饋孩子在校情況啊?)
- 01 實時天氣怎么取消訂閱(實時天氣扣費怎么取消)
- 03 新貿易保護理論中較有代表性的是對外貿易乘數理論和(保護貿易理論的主要內容是什么)
- 01 寶寶生日蛋糕網紅款圖片(網紅沙皮狗慕斯蛋糕怎么做?)
- 03 新加坡臨近的主要海外工業區有(初一地理)
- 01 容金貿易扣錢咋回事(到菲律賓工作怎么樣?)
- 01 室內網紅打卡點設計方案包括哪些(在公共空間的設計中,是否要為網紅設計專門的打卡點)
- 01 室內網紅打卡點設計博物館包(杭州值得看的博物館有哪些)
- 03 新疆中山國際貿易有限責任公司(新疆前進國際貿易有限責任公司怎么樣?)
热门文章
站长推荐
01 室內網紅打卡點設計圖片(新人在昆山網紅打卡點拍外景,被保安索要中華煙,保安有這個權力嗎?)
01 室內網紅打卡點設計圖片創意(重慶都有哪些網紅打卡點?)
01 家長會的買粉絲買粉絲推送文案(中小企業如何運營好買粉絲買粉絲)
01 室內網紅打卡點設計獎獲獎(重慶都有哪些網紅打卡點?)
01 寶武國際貿易(山東)有限公司(大動作!國企整合重組思路與抉擇,以寶武、國網為例)
03 新加坡的國際貿易和金融業發達嗎(留學問題。澳大利亞和新加坡哪個國家適合我的情況)
01 寶鋼北方貿易有限公司怎么樣(北京有哪些建筑公司)
01 宜賓市第四人民醫院買粉絲怎么查核酸檢測報告(西安市火車站到西安市第四人民醫院乘幾路公交可以到現在去四院看眼科需要核酸檢測嗎?)