As previously mentioned: to get the UI to update, you need to run your UIKit configuring code on the main thread. Peter Stienberger has posted a great snippet of code that raises an assertion whenever you attempt to access UIKit code from off of the main thread. Simply add the file to your project (and swap out the
NSLog) and build and run. Everytime you call UIKit code off of the main thread, it’ll crash your app. Great for finding bugs.
In OS X Lion and iOS 6 Apple added a new way to layout views, Auto Layout. This is a very powerful system that will handle a lot of the work and overhead of arranging your views. A well defined layout can make many headaches disapear entirely. However, it is a bit…quirky…to say the least.1
I recommend that you read the guide to the visual format language before going on.
This post will discuss the various options that you can set in
constraintsWithVisualFormat:options:metrics:views:. These options affect how the views described in the format string are to be aligned with each other.
I will not be tackling interface builder’s use of auto layout. I do not use interface builder heavily, and its quirks are a whole different story. ↩
You have a
YES, since you’d like to allows for bulk deletes or other actions. Prior to adding bulk editing support you also could perform a swipe-to-delete when not in editing mode. However, you’ve just noticed that swipe-to-delete no longer works. And you want both.
This is more of a note to my future self:
Don’t reference a view controller’s view in an init method.
Why not? Well, let me tell you what I did.
You’ve added an
MPMoviePlayerControllerto one of your view controller’s child views. You hit play, it starts playing the video. Then you hit the fullscreen button. It fills the screen, and suddenly everything goes black, you can’t get any controls, and all that happens is the audio keeps playing.
So what went wrong?