Monday, May 17, 2010

Some Good Advice

Posted by hiday81 at 9:59 PM
In the comments of my previous post, Joe Conway, one of the fine instructors over at the Big Nerd Ranch, co-author of one of the newer books on the iPhone SDK, and all-around nice guy had some really good suggestions. One of his comments was (I'm paraphrasing) "don't use an image when the image can be easily drawn with Core Graphics.

Joe posted some code to replace the gradient background in the previous post. Admonished for my laziness and inspired to make the code better, I incorporated his suggestion. I then finally went and bought Opacity (a vector drawing program that will output Core Graphics code) and used it to create a subclass of UIButton that will draw itself in a style similar to the buttons in UIAlertView using only Core Graphics calls, no images. These buttons can be drawn at any size and will draw correctly without the need for any images.

Once I've mastered Opacity, I'd like to replace the alert background image with Core Graphics code. Joe's also got some suggestions in his comments about how to make the status bar gray out, which I may incorporate into a future version.

If you're curious, you can check out the revised project incorporating Joe's suggestion as well as the imageless version of the alert button.

If you do any serious amount of iPhone work, you really should check out Opacity. If you're a hobbyist, they have a less-expensive version that may suit your needs.

Thanks Joe!

0 comments:

Post a Comment

Related Post

 

Copyright © 2011 Next Iphone | Store Mobile Phone Store