0
我需要在我的iPad應用程序中放置一個scrollView(帶有文本滾動內部)。爲什麼我的scrollView不能以我的座標開始?
我已經使用此代碼:
- (void)showRootPopoverButtonItem:(UIBarButtonItem*)barButtonItem
{
movie_scroll.frame = CGRectMake(50, 430, 700, 600);
movie_scroll.directionalLockEnabled = YES;
movie_detail.frame = CGRectMake(0, 0, 600, 400);
NSLog(@"You are in portrait from showRootPopoverButtonItem");
}
- (void)invalidateRootPopoverButtonItem:(UIBarButtonItem*)barButtonItem
{
movie_scroll.frame = CGRectMake(50, 540, 700, 400);
movie_scroll.directionalLockEnabled = YES;
movie_detail.frame = CGRectMake(0, 0, 600, 300);
NSLog(@"You are in landscape from invalidateRootPopoverButtonItem");
}
這太- (void)viewDidLoad
//change position for scrollView
if (UIDeviceOrientationIsLandscape(self.interfaceOrientation))
{
movie_scroll.frame = CGRectMake(50, 540, 700, 400);
movie_scroll.directionalLockEnabled = YES;
movie_detail.frame = CGRectMake(0, 0, 600, 300);
NSLog(@"You are in landscape from viewDidLoad");
}
else
{
movie_scroll.frame = CGRectMake(50, 430, 700, 600);
movie_scroll.directionalLockEnabled = YES;
movie_detail.frame = CGRectMake(0, 0, 600, 400);
NSLog(@"You are in portrait da viewDidLoad");
}
好吧,當我在肖像首次運行該應用程序時我沒有在滾動視圖的位置。如果我嘗試旋轉設備的scrollView起始位置...
爲什麼?