2014-04-08 75 views
0

我需要實現scrollview,它包含幾個與UINavigationBar和UIStatusBar縮放的子視圖。用UINavigationBar和UIStatusBar iOS縮放UIView

如何讓UIStatusBar在縮放視圖上顯示它?因爲現在我實現了這一點(如左圖所示 - 沒有狀態欄縮放視圖),但我需要這個(右圖所示):

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil]; 
//get view controller and navigation controller from storyboard 
UINavigationController *mainNavigControll = [sb instantiateViewControllerWithIdentifier:@"mainNavigControll"]; 
UIViewController *myViewObject = [sb instantiateViewControllerWithIdentifier:@"myViewController"]; 

//scaled view and all sub view 
CGAffineTransform transform = CGAffineTransformMakeScale(scale, scale); 
for(UIView* v in myViewObject.view.subviews) 
    v.transform = transform; 
[myViewObject.view addSubview:myViewObject.navigationController.view]; 
myViewObject.view.transform = transform; 

//get navigation bar and set navigation item 
UINavigationBar * navig_bar = mainNavigControll.navigationBar; 
[navig_bar pushNavigationItem:myViewObject.navigationItem animated:NO]; 
//add navigation bar to view 
[myViewObject.view addSubview:navig_bar]; 

//TODO: need added UIStatusBar ???? 
... 

//add to scroll view 
[_scrollView addSubview:myViewObject.view ]; 

這種滾動型必須看起來像多任務的iOS版7,但只有一些內部意見。

+0

這需要更多的澄清。你可以發佈一些代碼或你已經完成的一些研究嗎? – unspokenblabber

+0

將statusbarhidden設爲NO –

回答

0

在自定義視圖控制器中使用[[UIApplication sharedApplication] setStatusBarHidden:NO];