[問題] Beginning iPhone 3 Development Ch.5

看板MacDev作者 (狗狗)時間13年前 (2010/09/11 12:22), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
Beginning iPhone 3 Development (原文書)這本書的第115頁(第五章) 提到用兩個view來做rotation的轉變 不過我不太懂為什麼要這樣做... 程式碼如下: 在UIViewController底下.. - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation duration:(NSTimeInterval)duration { if (interfaceOrientation == UIInterfaceOrientationPortrait) { self.view = self.portrait; self.view.transform=CGAffineTransformIdentity; self.view.transform=CGAffineTransformMakeRotation(degreesToRadian(0)); self.view.bounds = CGRectMake(0.0, 0.0, 300.0, 480.0); } ...以下省略 } 當偵測到UI方向為Portrait時,就將view改為portrait (a UIView) 但是transform那邊以及bounds那邊的設定我就不太懂... 為什麼要將bounds設為平躺(landscape)的rect (300是因為扣掉上面的status bar) 然後transform的rotation都設為0度,但從左邊的landscape或右邊的landscape轉 都會依照原本的方向去向左或向右轉 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 120.126.38.191 ※ 編輯: leondemon 來自: 120.126.38.191 (09/11 12:24) ※ 編輯: leondemon 來自: 120.126.38.191 (09/11 12:25)
文章代碼(AID): #1CYmGAqC (MacDev)