Archive for January, 2010

Snippet: Round Corners

Here’s a clever snippet for displaying an image with rounded corners by masking it at runtime:

UIImageView * headerImage = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 10.0, 64.0, 64.0)];
headerImage.image = contactPhoto;

CALayer * layer = [headerImage layer];
[layer setMasksToBounds:YES];
[layer setCornerRadius:10.0];
[layer setBorderWidth:1.0];
[layer setBorderColor:[[UIColor blackColor] CGColor]];

[contactHeader addSubview:headerImage];

Mucking around with the view’s CALayer hadn’t occurred to us before, but if this does look half-decent, we’ve got some compositing code that’s in line for tossing. As they say, the only guaranteed bugfree code is the code you don’t write…

h/t: iPhoneFlow!

Continue Reading →
0

Source: InAppSettings

Here’s a handy controller for you to make it easier to both do the Apple-mandated thing and put your app’s preferences in Settings.app where no user can ever find them, and also in the app where users expect: InAppSettings!

InAppSettings provides a view controller that displays the application’s Settings.bundle as it appears in the iPhone settings. Allowing the same preferences in app and in the iPhone settings.

Anything that reduces code duplication is always good, indeed.

h/t: iPhoneFlow!

UPDATE: And as so strangely often seems to happen, there’s been almost simultaneously released a similarly targeted project called InAppSettingsKit. The no doubt scrupulously fair and balanced InAppSettings author has a detailed comparison here.

UPDATE 2: And if you feel like adding URL actions visible in InAppSettingsKit but not in Settings.app, check out the DDOpenURLSpecifier extension!

Continue Reading →
0

Source: TDBadgedCell

Here’s a handy-looking little class for doing MobileMail-style badges in your table views: TDBadgedCell!

TDBadgedCell.png

Each badge is drawn in a custom view using CoreGraphics. This means the class does not rely on extra images stored in memory, and the badges are drawn quickly on demand. You can set color properties for each badge, indicating hues for both the normal and highlighted states.

When working with cells without accessories — accessories are a table cell property defined in the official SDK — the badge is placed into the accessory view. When accessories have been defined, the badge is instead placed conditionally, to the left of of any shown accessory. The screen shot here demonstrates the use of the TDBadgedCell class using a table with disclosure chevron accessories.

The class inherits directly from UITableViewCell, and can be used in its place when providing cells for a table’s data source. Simply add the class to your Xcode project and return badged cells instead of standard table view cells. Use setBadgeNumber: to set the badge to an integer value.

Sounds properly designed, looks elegant, good stuff indeed!

h/t: TUAW!

UPDATE:

Here’s an alternative cell badge implementation which looks like it adds some features: DDBadgeViewCell!

Continue Reading →
0

MGTemplateEngine

So yes, we’re baaaaaack; and perchance we’ll slip in some Japan/Korea posts over the next few days as we get things sorted out and up and running around here again. In the meantime, no we have pretty much no idea what’s been going on in the iPhone world the last three weeks, but while we’re figuring that out we’ll pass along some bookmarks sitting around from before we left.

For starters, here is MGTemplateEngine for your Cocoa output processing needs:

MGTemplateEngine is a native Cocoa system for generating text output based on templates and data. It’s a close cousin of systems like Smarty, FreeMarker, Django’s template language, and so on.

It’s ideal for Cocoa apps needing to generate text output using variable-substitution (with looping and/or conditional logic), including creating HTML pages (or for apps with WebKit-based UIs), generating invoices or other printable templates, mail merge, data export or any number of other things. It’s also great (in combination with WebKit) for letting your users create themes/styles for your application…

Handy if you need it!

Continue Reading →
0
Page 2 of 2 12