Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9231661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:07:37+00:00 2026-06-18T06:07:37+00:00

I am using MGSplitViewClass (link) and I’m having severe difficulty getting the size of

  • 0

I am using MGSplitViewClass (link) and I’m having severe difficulty getting the size of a UICollectionView correctly set. In said split view I have in the master view a set of four UIViews that contain more robust views (table views, groups of labels, and a collection view).

First I tried to add the UICollectionView in my nib and programmatically created a collection view controller and connect it to my nib’s collection view. This failed horribly as soon a I tried
_collectionViewController.collectionView = myCollectionView;.
This gave errors about the view from my nib being outside of the subtree
'NSGenericException', reason: 'Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal.

Fine, now I’ll remove the collection view from my nib and add the one the collection view controller comes with, like so.

_collectionViewController = [[[MyCollectionViewController alloc] initWithCollectionViewLayout: [[[MyCollectionLayout alloc] init] autorelease]] retain];
[_collectionViewController.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Cell"];
UICollectionView* collectionView = _attachmentController.collectionView;
[_collectionViewContainer addSubview:collectionView];

This works but the collection view is overflowing the view container’s size significantly and other layout issues. Now obviously the view will not scroll properly like this so I have to fix it.

So I add some constraints to get the view sized to fill the container view.

NSMutableArray* constraints = [[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[collectionView]|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:NSDictionaryOfVariableBindings(collectionView)] mutableCopy];
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"|[collectionView]|" options:NSLayoutFormatAlignAllCenterX metrics:nil views:NSDictionaryOfVariableBindings(collectionView)]];
for (NSLayoutConstraint* lc in constraints)
    [_attachmentViewContainer addConstraint:lc];

But this is where it gets screwy. Upon running this I get more layout errors.

Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
"<NSAutoresizingMaskLayoutConstraint:0x1d8c0b80 h=-&- v=-&- UICollectionView:0x1cb55400.midX == UIView:0x1d894300.midX - 10>",
"<NSLayoutConstraint:0x1c5a74b0 H:[UICollectionView:0x1cb55400]-(0)-|   (Names: '|':UIView:0x1d894300 )>",
"<NSLayoutConstraint:0x1c5a7440 H:|-(0)-[UICollectionView:0x1cb55400]   (Names: '|':UIView:0x1d894300 )>"

and

"<NSAutoresizingMaskLayoutConstraint:0x1d8c0d10 h=-&- v=-&- UICollectionView:0x1cb55400.midY == UIView:0x1d894300.midY + 437>",
"<NSLayoutConstraint:0x1c5a71a0 V:[UICollectionView:0x1cb55400]-(0)-|   (Names: '|':UIView:0x1d894300 )>",
"<NSLayoutConstraint:0x1c5a6f30 V:|-(0)-[UICollectionView:0x1cb55400]   (Names: '|':UIView:0x1d894300 )>"

Where did those random looking NSAutoresizingMaskLayoutConstraints come from? A better question is where can I get rid them? I cannot seem to find a single point in the code to jump in a kill them. -viewWillAppear: is not propagated past UIViewController so I’m sort of stuck.

Any thoughts are very welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:07:39+00:00Added an answer on June 18, 2026 at 6:07 am

    Just before you add those constraints, try adding this line:

    [collectionView setTranslatesAutoresizingMaskIntoConstraints:NO];

    The system will automatically translate the default autoresizing mask to constraints unless you set this to NO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using getDefinitionByName I am consistently getting the error saying it is not defined (as
Using the example here as a starting point, I set out to customize my
using MSQL 2005 I have a continuous set of flow measurements (averaged for each
using phpPgAdmin, I've tried to create a table in my database. But am getting
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain
Using a populated Table Type as the source for a TSQL-Merge. I want to
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using SQL Server 2008 R2 we are looking for a way to select the
Using CI for the first time and i'm smashing my head with this seemingly
Using the Redis info command, I am able to get all the stats of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.