NSGenericException’, reason: ‘Unable to install constraint on view

You need to install the constraint on the “higher” of the two views. A good, general way to do this is like this: NSLayoutConstraint* constraint = …; NSView* firstView = constraint.firstItem; NSView* secondView = constraint.secondItem; [[firstView ancestorSharedWithView: secondView] addConstraint: constraint]; Just a word of caution: It’s good to remember here that constraint attributes are evaluated … Read more

change the height of a UICollectionReuseableView (collection section header) dynamically

Your delegate should implement the following function, assuming you’re using a flow layout: – (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section; You can return a different size for each header. In horizontally scrolling collection views, only the width is used. In vertically scrolling ones, only the height is used. The unused value is ignored — your view will … Read more

The Xcode xcshareddata directory?

The xcshareddata directory is primarily used to store shared settings (as opposed to xcuserdata which is used for settings which are not shared a.k.a. user specific). The following are some items currently stored in ‘xcshareddata`: Schemes: schemes can be shared in Xcode with the “Scheme manager” which can be accessed via the “Product” > “Scheme” … Read more

Xcode 4.5 command line unit testing

Just thought I should also share what I did for a solution to this issue. I followed the solution outlined in https://stackoverflow.com/a/10823483/666943 but converted the ruby script to shell. At the end I basically installed ios-sim via homebrew and replace the Run Script in the Build Phases of my Test target with the following: if … Read more

IBOutlet link to embedded container view controller

Another option for some cases is to capture the embedded controller using -prepareForSegue:sender:. For example, if I have a UINavigationController embedded within a CustomContainerViewController, I can name the embed segue embedContentStack in the storyboard and capture it in CustomContainerViewController via – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@”embedContentStack”]) { // can’t assign the view controller … Read more