Category: Posts
-
Asynchronous Networking with NSURLSession
iOS 7 introduces an entire new networking stack for developers,NSURLSession. Generally it makes the common tasks simple, and the hardtasks possible. It also drives the new background fetch capabilities as well. Like my earlier post, offloading your networking from the mainthread is a simple way to help keep an app responsive. Doing this withNSURLSession is…
-
Verifying UIKit is Running on the Main Thread
As previously mentioned: to get the UI to update, you need to run yourUIKit configuring code on the main thread. Peter Stienberger has posted agreat snippet of code that raises an assertion whenever you attempt toaccess UIKit code from off of the main thread. Simply add the file to yourproject (and swap out the PSPDFLogError…
-
Alignment Options in Auto Layout
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 ofthe 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…
-
Swipe to Delete with Multiple Selection
The Problem: (Solution found via StackOverflow) You have a UITableView that hasallowsMultipleSelectionDuringEditing set to YES, since you’d like toallows for bulk deletes or other actions. Prior to adding bulk editing supportyou 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. The Solution:…
-
Don’t Reference View Controller Views in init
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. The Setup Custom UITableViewController subclass. Has a few custom variables thatstore useful data. An array of things to display, some basic text, etc. Theseall get…
-
MPMoviePlayerController Going Fullscreen Creates A Blackout
The Problem: (Solution found via StackOverflow) You’ve added an MPMoviePlayerController to one of your view controller’schild views. You hit play, it starts playing the video. Then you hit thefullscreen button. It fills the screen, and suddenly everything goes black, youcan’t get any controls, and all that happens is the audio keeps playing. So what went…