2011-03-02 70 views
0

我還沒有花足夠的時間查看TTLauncherView背後的代碼,但它在橫向模式下似乎在右側有一個空白區域。我正在考慮重寫啓動器,但任何人都有更優雅的解決方案?我想刪除空白區域,而是將項目重新組織到該空白區域。在iPad橫向模式下的TTLauncherView在右側有一個空白區域

+0

我有你可以繼承TTLaucherView並添加橫向支持。我可以證實,這並不是那麼快。 – MacTeo 2011-03-02 07:18:02

回答

1

我認爲你可以做到這一點有很多比這更容易......我是很新,這個工具包,但這似乎在我的應用程序的工作:

-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 
[self.view setBackgroundColor:[UIColor clearColor]]; 

}

-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 
    [_launcherView setFrame:self.view.bounds]; 
} 

編輯: 對編輯,我只是​​找到更好的方法來做到這一點。我們可以重寫一個動畫方法,該方法可以自動動畫TTLauncherItems的旋轉。我已經改變了視圖的alpha值來隱藏圖標旋轉的陡峭性:

-(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 
    [_launcherView setFrame:self.view.bounds]; 
    //[self.view setAlpha:0.4]; 
    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:.1]; 
    [self.view setAlpha:1]; 
    [UIView commitAnimations]; 
} 
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 
    [self.view setBackgroundColor:[UIColor clearColor]]; 
    [self.view setAlpha:1]; 
    [UIView beginAnimations:nil context:NULL]; 
    [UIView setAnimationDuration:.1]; 
    [self.view setAlpha:0.7]; 
    [UIView commitAnimations]; 

} 
0

這可以更容易完成。我喜歡這個沒有使用willRotate方法的解決方案:

-(void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 
    [UIView beginAnimations:nil context:NULL]; 
    [_launcherView setFrame:self.view.bounds]; 
    [UIView commitAnimations]; 
} 

它爲我工作!

相關問題