[coneybeare code]

The Findings of an iPhone Developer

How to Make Custom Drawn Gradient Backgrounds in a Grouped UITableView with Core Graphics

In iPhone app design, it is important to find a balance between customization and familiarity.  Many times, subtle differences are all you need to make yourself stand out from the crowd.  While doing the Ambiance 3.0 redesign, I wanted something to make my list of content a little different than all the other cookie cutter table views out there.

A great place to start is to implement your own background and use a clear table view background.  Many apps are now doing this and it is come to be expected from a grouped UITableView that is done with a little love.  Another way to spruce up these tables is to add a custom background color.  Since 3.0, this has been as easy as setting the cells backgroundColor property.  I implemented both of these and it wasn't enough for me. It still looked like so many apps out there.  I thought about putting a gradient view as the background, only to find that setting a grouped UITableViewCell's background ignored the nice rounded corners of the cell.  Almost giving up, I googled around to see if anybody else has done it and shared some code.

I found this post on StackOverflow:  http://stackoverflow.com/questions/400965/how-to-customize-the-background-border-colors-of-a-grouped-table-view

This was a great resource as it helped me in the right direction — Core Graphics.  It was meant as a way to customize the background of a cell before the 3.0 sdk came out, but I used it as a basis for my code to draw a gradient!  It needed tweaking and optimization, but after a little bit of hacking away at it, I was able to get it to work nicely.  I present to you the UACellBackgroundView.

To use the UACellBackgroundView, simply add the .h and .m files to your project, then use it as the cell background view.

.h file
.m file

Whenever you want to use it, just set the cell's backgroundView to be the UACellBackgroundView in your own UITableViewCell Subclass's initWithStyle  method.  Then, when you have your data and are creating cells, simply set the position of the cell by calling setPosition, of just call the line directly if you don't want to subclass the UITableViewCell.  The position is important as it lets the cell know to draw itself correctly depending on whether or not the cell is first, last, in the middle, or a single cell.

Hope this helps you in your quest for a better app.  If you want to use it, you will have to set your cell labels and elements to have a clear background, so hopefully you have a fast drawing method and have optimized your table view cells to do minimum work during scrolling.

Loading mentions Retweet
Posted February 1, 2010
// 0 Comments

Fixing symbolicatecrash...

Because you found your way here, I am assuming you already know what symbolicatecrash is and when/why you would use it.  If not, take a detour here and come back.  This tool has been great but is very temperamental.  It worked for a while when I first started, then it broke and stopped giving results.  I applied the Alan Quatermain Fix, but things still weren't right.

Well, tonight I had a client app rejected from crash I couldn't reproduce.  I only had 1 crash log from Apple, and the stupid symbolicatecrash script wasn't finding anything!  I had to dig in and see what was up.  After spending a little bit brushing up my Perl, I was able to fix the problem.

Basically, the Regex that the script uses was failing to match in two places: the bundle name, and the versions.

Change lines 372-377 in the symbolicatecrash script to look like this:

There are 2 changes from the pre-Alan-Quartermain-Fix:
On line 374, I changed the "(.+)" to be "([^\s]+)" just like the AQ fix. 
On line 375, I changed the "\s+ .+ \(.+\) \s*" to be "\s+ \w+ \s*" because my crash reports never have versions in parenthesis.

I don't know if this will work for everybody, but it works for me and the crash reports I get back from iPods and iPhones.  Good luck!

Loading mentions Retweet
Posted October 29, 2009
// 0 Comments

Ambiance has been named the "App of the Day"...

(via http://appoftheday.com/app/Ambiance )

Its a great honor to be named alongside apps like Tweetie 2 and DropBox. This is great!

Loading mentions Retweet
Posted October 29, 2009
// 0 Comments

Overriding -[UINavigationBar drawRect:] to add a custom background image...

I needed to do this across the board for a client app and thought I would share…

Loading mentions Retweet
Posted October 27, 2009
// 1 Comment

Ambiance and Ambiance Lite 2.2 Just Released...

Ambiance and Ambiance Lite 2.2 have just been accepted by Apple. The 2.2 update is a pretty big update to Ambiance with some new and highly-requested features being added. Here is whats in the release:

NEW FEATURES

- Send and Receive Sounds, Mixes and Playlists between 2 devices running Ambiance or Ambiance Lite!

- Facebook Status Updates
- Twitter Status Updates

- Backup your sounds and settings — Restore them if something goes wrong

- New Playlist Support! Sounds can be in multiple playlists

- Can now turn off iPod playlist when timer exits

BUG FIXES
- Push Notifications now will hold settings if you choose not to get them.
- Alarm now works again when the phone is unplugged overnight.
- Fixed a rare quickstart bug that would crash the app
- Easier editing of mixes and playlists (on the mix/playlist details screen)
- Various smaller bug fixes
- Memory enhancements

Loading mentions Retweet
Posted October 12, 2009
// 0 Comments

Adding and Saving a Border Around a UIImage with Core Graphics

I recently had to place a border around an image of unknown size and save it back as an image. Here is how:

Start with a UIImage:

Run it through this method:

You will get back a UIImage with a border. Simple.

Obviously, you will need to adjust the border percentage and color for your own application.

Loading mentions Retweet
Posted October 6, 2009
// 0 Comments

Proper Alignment of UIImage and UILabel when using UITableViewCellStyleSubtitle

I am working on an iPhone App Project for a client and I decided to use the UITableViewCellStyleSubtitle for one of my views. It was easy to setup and it had all the details I needed. The only customization I did was change the detailTextLabel.numberOfLines to 2. So I loaded up my content and to my dismay, the cell is not intelligent enough to line up the labels horizontally across all cells. This really, really bothers me.

Before I set out to create my own class and draw my own labels and images, I thought I would just subclass UITableViewCell and try overriding the layouts for what I needed.
 

 
Turns out that was all I needed. After using this subclass instead of a UITableViewCell, I now get my image filling the square (if possible) and the Text Labels all lined up vertically.

This code makes 2 assumptions:
 
1) You want a square imageView that has a width equal to the height of the cell - 1 (for the separator)
2) You want the image to be aspect fit
 
Enjoy!

Loading mentions Retweet
Posted September 18, 2009
// 1 Comment

A Teaser of a Sweet New Feature in Ambiance 2.2

Loading mentions Retweet
Posted September 15, 2009
// 0 Comments

One of the Benefits of Being an iPhone/iPod App Developer...

... I get to play with tons of devices!

Loading mentions Retweet
Posted September 11, 2009
// 0 Comments

Finally! Drivers for my Canon MX860 and Snow Leopard

http://www.usa.canon.com/consumer/controller?act=ModelInfoAct&tabact=SupportDetailTabAct&fcategoryid=238&modelid=18121#DownloadDetailAct

Loading mentions Retweet
Posted September 9, 2009
// 5 Comments