Date Formatting

Date and Time Formatting are an annoyingly cumbersome topic for most engineers and designers. There’s various combinations of date and time that we can show to people and honestly I’ve found there’s a few things that we can do to avoid confusion. This blog post covers the standard Gregorian calendar involving formatting. When talking about other systems like the Japanese imperial system or the Buddhist calendar then we’ve got a more complicated system in place. Don’t ever do MM/DD/YYYY (or DD/MM/YYYY) If we ever plan on internationalizing the format where we show something like 02/04/03 (or 2003) is incredibly confusing. This is the 2nd of April in a more European style, this is 4th of February in the United States. The ISO format of YYYY-MM-DD where things are descending in units of magnitude is the best format for international audiences. I would love if we could all just move to ...(Read More)

Implementing Scroll to Bottom Event iOS

Scroll to the End Event – iOS Say you want to determine if somebody has scrolled to the bottom of your TableView. How would you go about doing that? Basics The complicated part of registering the event is actually determining when someday has scrolled to the end BUT not including events that include the bounce. The second thing we need to know is that a UITableView is subclass of UIScrollView, so it has common delegate methods and common methods. The things that matter to us are contentSize – the actual size of the content inside our tableView / scrollView. If you have 10 cells with a height of 100 each, that means you contentSize height will be 1,000. contentOffset – the offset from the origin of the inner bounds of the content inside the scrollView. If you scroll to that 4th cell, that means you are contentOffset {0, 400} contentInsets ...(Read More)

NSUserDefaults Best Practices

NSUserDefaults NSUserDefaults is Apple’s way to store user preferences for iOS (it’s for OSX as well but I don’t do OSX Development so I can’t talk at length about that). The data is namespaced into your own persistent domain (usually the name of your app) and cannot be accessed by others apps in iOS as it is sandboxed. Most people use NSUserDefaults for storing data between sessions. Anything that you would want to persist between sessions such as: a user’s preference for the number of items to display, whether or not somebody has seen a hint about how to use a feature, etc. I’m sure other people utilize NSUserDefaults in more creative and elaborate ways but that is my primary purpose. I’ve never actually found a good guide on how to use it and best practices with it so I figured I would write one up. This is mostly my ...(Read More)