Frequency for iPad

It’s been six months in the making but we’re finally live. I, the folks over at Front-ended and the Frequency team in L.A. have been hard at work creating the best online video experience imaginable, and it has arrived!

The app aggregates video from hundreds of different sources across the internet and categorizes them into different channels – comedy, news, music, technology and more. You can subscribe to any or all of these channels and they will be presented to you in a beautiful user interface. Everything is updated in real time and you’ll always see new videos popping in. Get it for FREE on the App Store!

Nomad Editions – Original Weekly Magazines for your iPad

Over the past couple months I’ve been hard at work creating an iPad application for the NYC-based digital media company Nomad Editions. Nomad is a small team of publishing-industry professionals who have joined forces to create several new original magazines exclusively for the iPad. Subscriptions to each magazine are just $0.99 for a month, for which you get 4 issues, or $9.99 for the whole year. Screenshots of the app below.

You can download the Nomad Editions app for free from the App Store (currently iPad only) and subscribe to any or all of the magazines you want via In-App Purchase. Check it out.

Skinning a UIProgressView with drawRect and images

Here is an easy way that I’ve come up with to skin the default UIProgressView in an iOS application using just 2 images, and implementing the drawRect: method.

This is what the default progress view looks like:

…and here is our custom skinned version.

To achieve this you will need 2 images: one for the background, and one for the fill. The images that I’ve shown here were designed by Darran Morris so please give credit if you use them.

Update: You can download the images I’ve used here: progress-bar-bg.png, progress-bar-fill.png

Once you have your images created like mine above, create a new Objective-C class. In your header file make it a subclass of UIProgressView.

// CustomProgressView.h

#import <UIKit/UIKit.h>

@interface CustomProgressView : UIProgressView {

}

@end

Next in your implementation file we will create and use our images to draw the progress bar. Note that the images have to be “stretchable” in order to work correctly and to be able to render at different widths and heights.

// CustomProgressView.m

#import "CustomProgressView.h"

#define kCustomProgressViewFillOffsetX 1
#define kCustomProgressViewFillOffsetTopY 1
#define kCustomProgressViewFillOffsetBottomY 3

@implementation CustomProgressView

- (void)drawRect:(CGRect)rect {

    CGSize backgroundStretchPoints = {4, 9}, fillStretchPoints = {3, 8};
   
    // Initialize the stretchable images.
    UIImage *background = [[UIImage imageNamed:@"progress-bar-bg.png"] stretchableImageWithLeftCapWidth:backgroundStretchPoints.width
                                                                                           topCapHeight:backgroundStretchPoints.height];
   
    UIImage *fill = [[UIImage imageNamed:@"progress-bar-fill.png"] stretchableImageWithLeftCapWidth:fillStretchPoints.width
                                                                                       topCapHeight:fillStretchPoints.height]
   
    // Draw the background in the current rect
    [background drawInRect:rect];

    // Compute the max width in pixels for the fill.  Max width being how
    // wide the fill should be at 100% progress.
    NSInteger maxWidth = rect.size.width - (2 * kCustomProgressViewFillOffsetX);

    // Compute the width for the current progress value, 0.0 - 1.0 corresponding
    // to 0% and 100% respectively.
    NSInteger curWidth = floor([self progress] * maxWidth);
   
    // Create the rectangle for our fill image accounting for the position offsets,
    // 1 in the X direction and 1, 3 on the top and bottom for the Y.
    CGRect fillRect = CGRectMake(rect.origin.x + kCustomProgressViewFillOffsetX,
                                 rect.origin.y + kCustomProgressViewFillOffsetTopY,
                                 curWidth,
                                 rect.size.height - kCustomProgressViewFillOffsetBottomY);
   
    // Draw the fill
    [fill drawInRect:fillRect];
}

@end

That’s it! Now you can use this progress view like you would any other UIView by calling initWithFrame: and passing a CGRect – and since the images are stretchable you can make it any size you want.