2017-07-03 32 views
0

我正在使用一個應用程序與多個UIViews使用一些UIViewcontrollers。我試圖設置自動佈局,但UIViews不縮放到UIViewcontroller大小。有人可以指出我解決這個問題的方法,無需重新設計應用程序架構嗎?Autolay iOS與單uiviewcontroller和多視圖


所以我有一個UIViewController和子視圖的UIView(addNoteUIView)

當我加入子視圖到ViewController的 子視圖Addnote查看未通過自動佈局調整屏幕和它的邊界裁剪。

the subview does not resize to the bounds of the device

如何您解決第二的UIView(加註視圖)遵循設備的邊界?

編輯

感謝維沙爾

我設置上的viewDidLoad

[self.collectionView setFrame:self.view.frame]; 
[self.collectionView setNeedsLayout]; 

框架不過,我正在從細胞中這種行爲。這是爲什麼發生?多重界限? see image with collection view cell error

我的收藏項目大小碼

- (CGSize)collectionView:(UICollectionView *)collectionView 
        layout:(UICollectionViewLayout*)collectionViewLayout 
    sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ 

    CGRect screenRect = [_collectionView bounds]; 
    CGFloat screenWidth = screenRect.size.width; 
    CGFloat screenHeight = screenRect.size.height; 

    CGFloat cellWidth = (screenWidth/(_lcolumns)); //Replace the divisor with the column count requirement. Make sure to have it in float. 
    CGFloat cellHeight = (screenHeight/(_lrows)); 

    if(cellWidth < cellHeight) 
     return CGSizeMake(cellWidth, cellWidth); 
    else 
     return CGSizeMake(cellHeight, cellHeight); 

} 
+1

它不清楚你想實現什麼。向我們展示一些工作代碼或佈局。 – luckyShubhra

+2

向我們展示您的問題的屏幕截圖。很難理解整個問題是什麼 –

+0

我更新了上面的問題 - 希望能讓它更清晰一些? – Koen

回答

0

它不使用調整大小自動版式需要設置框,或者您需要以編程方式給予約束。