SlideView Contribution

One of my favorite iPhone related sites to read is iPhone Developer Tips.  The tutorials are outstanding and most importantly "real world" useful.  Back in August there was a blog posted showing how to implement a "slideable" message that can be presented to a user.  After reading through it I decided to modify how it was used to make it a little more extensible for an iPhone project that I am working.  After I got everything working correctly and they way I wanted to I decided to contact the site owner, John, with all of my source code in case he wanted to use it.

After a little more tweaking to my code he posted my changes, as well as another developer, Greg's code in a new post.

This is a small example of the importance of using open source software, as well as, the importance for developers to use the knowledge and skills of other developers to make the good....GREAT.

Sliding Views On and Off Screen – Part 2 – Reader Contributions

Using NSNotificationCenter with UINavigation Controllers

When presenting an app to user with a large list of information, most developers will add in the ability to search the list inside of the table view.  To further increase usability it is a good practice to include different filters.  For example, a scope button that allows the user to filter by name, address, phone number, etc.  Implementing these features is pretty straight forward.  However, one of the filter options that was needed for a particular app that I am working on was to filter by department.

The complexity to this problem came in the fact that the search term couldn't be the department name, but the code.  Obviously, most users don't know the corresponding codes for a given department.  So I needed a way to present a list of "friendly" department names to the user to pick from, and once a given department was chosen then the corresponding department code would be populate the search bar field.

The first attempt was to use a UIPickerView.  Unfortunately, this wasn't the best solution mainly because you can't use key/value pairs with the UIPickerView.  Well...not in a very straight forward manner.  My second solution attempt was to use a modalViewController and then pass the selected object back to the parent controller.  Everything worked out just fine, but the parent object property wasn't being updated.

To solve this problem there are a couple of schools of thought.
  1. Set the parent controller as the delegate and setup a new protocol that the child controller implements.
  2. Use the NSNotificationCenter which uses the Observer Pattern to update another object based upon some action/method.

Most of the time I would say that the second option is overkill since it is designed for a one-to-many object broadcasts, but in this use case it is the preferred approach because "you would otherwise have to pass instances around of delegates just to connect objects". -

After a user selects the appropriate department, the child controller is dismissed and the search bar text is updated with appropriate department code.