*Coder Blog

Life, Technology, and Meteorology

Month: January 2013

Storyboard Change

This Storyboard change bit me this morning. I was trying to do some initial calculations from my view geometry before it is displayed at app launch. Previously, when using XIB files to define an interface, you would be able to see your view geometry as early as viewWillAppear: in your UIViewController.

With Storyboards, view geometry will not be ready until later. In my case, within viewWillAppear: the view bounds returned all zeros. Took a bit of Googling to find the answer, but eventually came across this question at StackOverflow:

Gettting [sp] subViews’ frames in Storyboard

In short, if you need your view geometry as early as possible, use viewDidLayoutSubviews in your UIViewController.

The intersection of two NSIndexSets

If you are looking for code to compare two NSIndexSets and return their intersection, this is for you. The algorithm is pretty easy, so I decided to wrap it together and post it to Gist. It’s implemented as a category on NSIndexSet.

NSIndexSet+GSIndexSetAddditions

© 2017 *Coder Blog

Theme by Anders NorenUp ↑