Constraints Killing You? Blame Auto-Layout.

I recently made a new project and when I ran it the UIButtons and UIViews would all change size and weird things would happen. I now understand that it was merely the auto-layout completely freaking out and trying to fit things into a space in which they already fit.

Are constraints moving around your interface builder elements too much?

Here is what the constraints look like in Xcode. They seem to show up automatically and cannot be manually deleted. I deleted a few of them before I realized that they’d come back even stronger. I’m sure it works for someone to fix their app into both the 3.5″(old + retina) and 4″(iphone 5) versions of the iPhone now. I’m sure the new versions of XCode will work quickly to fix this feature. When I was struggling to figure out what is wrong I realized constraints would prevent me from moving UIViews around the screen. That more than anything else really bothered me. To impinge on normal functionality is a cardinal sin.
Continue reading

Sorting Segues Sanely

There are three kinds of segues, push, modal and custom. You’ll probably most often use the ‘push’ method. It is incredibly useful in making storyboards do stuff.

Primarily there are two ways to invoke a segue. One is to rig up a button in Interface Builder that triggers a segue. The other is to invoke the segue on your own. I think that a lot of times I need to validate what’s on the screen before I can release it to the next controller. Therefore I need to do it myself.

Also you need to pass information back and forth, which will be taken care of by setting variables in the method:

-(void) prepareForSegue:(UIStoryBoardSegue *)segue sender:(id)sender {
//...
}

Continue reading