Posts Tagged ‘open source’

FTUtils Fork

Friday, April 9th, 2010

I recently forked FTUtils to provide some functionality I needed for FJSTransitionController.

These changes may be of use to others as well.

1. Diagonal direction control.
For when you want to slide a view in from the corner of the screen.

2. Enclosing View support.
This is a bit convoluted, but: All animations in FTUtils are assumed to move in and out of the full screen.
When would this be an issue?
If you perform 2 animations at the same time that are enclosed in a view that is less than full screen. Basically, this boils down to the animation curves will be “out of sync”.

Open Source iPhone: Resources 2

Tuesday, December 1st, 2009

Another list of open source libraries:

http://boredzo.org/opensourcelinks/byauthor.html

Open Source iPhone: Resources

Wednesday, November 18th, 2009

Great Resource, tagged and organized:

http://cocoaheads.byu.edu/resources/open-source

Originally suggested in this Stackoverflow question.

Open Source iPhone – Glossy Buttons

Friday, September 11th, 2009

The buttons in the iPhone SDK suck. There, I said it.

Almost everything on the iPhone round, glossy and “3Dish”.

Except the standard RoundRect buttons included in UIKit.

Of course we can go off and use one of many drawing apps to crank out some nice glossy buttons, but there a few problems with this approach.

First, you have to be at least competent in using some advanced drawing tool.

Second, any buttons you create are static and must be shipped as a resource in your app. It is acceptable to want to generate multiple colors on the fly.

To solve our dilemma, we can use the work of two other people.

Matt Gallagher posted a great article on generating gloss gradients a while back.

It’s quite informative in explaining and implementing the effect. You can run a OS X app and play around with the setting.

The code didn’t quite work on the iPhone because of the absence of NSColor.

So we have two problems. First, we need to adapt the code to the iPhone. Second, we need to add this code to UIButton as a category.

Good news everyone! It’s already been done.

More than that, you can follow a 5 step tutorial taking you through the process of building the code and some explanation behind it.

The first post of the series can be found here.

I would credit the author, but I think he (or she) has gone through great pains to omit his (or her) name from the blog. (Or maybe I’m just too dense).

Update: Michael Heyeck wrote in to claim his awesome work and updated his “About” page to be a little more forthcoming.

Anyways, try it out. It works good for making glossy buttons pretty quickly and it is tweak-able.

Open Source iPhone – JSON Data

Friday, July 24th, 2009

I’ve used/repurposed several open source projects for use in my code.

If you’re not trying to use someone else’s code as much as possible, you’re not doing OOP.

I won’t call this a series, but I would like to showcase some of the great code that is out there waiting to be used. All you have to do is drop it in your project.

This time I’ll point out a framework that I use very frequently:

json-framework (available on Google Code)

It’s drop dead simple to use. You give it data, it gives you a Cocoa Object, end of story.

Here is how I use json-framework in some of my code.

JSON.png

The SBJSON class gives you back a NSArray, NSDictionary, or an NSError (pointer reference).

If you need to parse JSON data, check it out.

I found Three20 and my lost weekend

Monday, May 18th, 2009

I’m currently involved in a project where I need to load some photos from the web and I need a UITableview with some thumbnails and with Photo.app navigation.

Enter Three20. Three20 is a framework written by Joe Hewitt that abstracts much of the functionality of UITableViews, UITableViewCells, and networking away from the programmer. The way the components are abstracted is clearly MVC, but done in a more “web application” way. I believe Joe commented in his recent interview on the Mobile Orchard podcast.

When you download Three20, there is a nice sample app included with just about everything you can create. This provides a great overview of what is included within the framework.

The functionality of the UIKit classes has been abstracted to the point that you never really touch the usual delegate and datasource methods. You create view and controller objects through a completely different programmatic interface.

You can create tableviews and photo galleries very easily by just adding creating a data source array and the view classes basically take care of themselves. This was very cleanly done. For instance, to determine the type of cell that will appear in your table, you populate your datasource with a specific type of *Field object. A TTTextTableField produces a text cell, a TTSwitchTableField yields a cell with a switch, etc…

To create a Photo Browser View and/or a Photo Thumb View is slightly more difficult. You will need to define your own Photo Datasource class. In the example code, there is a mock photosource class setup that provides a good starting framework.

Unfortunately, the requirements for my current project didn’t allow me to use the Three20 classes as is. I had to dig a little deeper into the framework and modify it to suit my needs.

When you dive into the code, you quickly find all the Cocoa classes have not been merely subclassed, but have had there behaviors completely altered. I could use the basic, high-level classes, but I could not understand exactly how they worked behind the scenes. I needed to subclass the TTThumbViewController and I had to understand what I needed change to make it work for me.

To be frank, it is complicated. So complicated, I considered giving up subclassing it several times during my adventure. As I began to decipher the interconnections and roles of different objects, some design patterns began to fall out. An interesting note is Three20′s use of delegates. There are many delegates and controllers and controller delegates and datasource delegates, etc…  This was one of the main reasons it was hard for me to fully comprehend the framework. I literally had to pull a notebook out and start drawing the connections between the classes.

After a few hours,  I felt I had a decent understanding of the underpinnings of the relevant classes which I needed to alter. I began to make my construct my classes and finally accomplished my goal of customizing the thumbs view to the following:

Thumbs Table View

I know, not very impressive on the surface. What I managed to do was add section support to the TTThumbsViewController. The stock class only supports a single section with no division between the rows of photos. Also, it only supports one photo source per view. I have changed it to allow a photo source per section (Even though it looks like one source, it’s actually 2 sources with the same data).

It’s not bug free yet, and [redacted] betas are a little picky. When I get a little more solid, I’ll see if I can get a fork going on GitHub and upload my additions there.

In the end, I think it was worth getting intimate with Three20 to get all of the networking and photo browsing goodness for free.

I encourage everyone to check out Three20. It works great for just about anything you want to do. If it was my decision, I would have just changed my design to accommodate the framework and save myself a weekend.

Let me know if any of you have used Three20 and what your experiences were.