我已經試過這樣:搬家標籤中心新點時,方向改變
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self adjustViewsForOrientation:toInterfaceOrientation];
}
- (void)adjustViewsForOrientation:(UIInterfaceOrientation)orientation {
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
intervalLabel.center = CGPointMake(100, 100);
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
intervalLabel.center = CGPointMake(200, 200);
}
}
但沒有奏效。但是,如果我這樣做,將移動它
- (IBAction)sup:(id)sender {
intervalLabel.center = CGPointMake(100, 100);
}
BTW該標籤在故事板製成,並outleted我的看法沒有負載,並設爲(弱,非原子)和按鈕在也做了故事板和僅僅是一個標準的IBAction爲
不清楚你想要做什麼 - 你將中心設置爲0,0,然後立即調用moveLabel將其設置爲100,100。你只是在風景方向上調用它,而不是在肖像方向上調用任何東西。所以這個標籤不應該移動 – ksimons
k我改變了它所以它應該是正確的,但是當設備旋轉時仍然標籤不移動 –