Friday, September 13, 2013

Icon set Creator v2.0 (iOS7)


Previous post here: iOS Icon set Creator

So here's what the updated Automator workflow does:
Asks for your base (512x512 OR 1024x1024) icon image then duplicates it, scales it and renames it, rinse and repeat until all thirteen (13) icons are created.

Notes: If you use 1024 size you can (and should) use that icon to upload to iTunes Connect.


Icon-120.png = 120x120
Icon-144.png = 144x144
Icon-152.png = 152x152
Icon-72.png = 72x72
Icon-76.png = 76x76
Icon-Med-40.png =40x40
Icon-Med-40@2x.png = 80x80
Icon-Small-50.png = 50x50
Icon-Small-50@2x.png = 100x100
Icon-Small.png = 29x29
Icon-Small@2x.png = 58x58
Icon.png = 57x57
Icon@2x.png = 114x114


The workflow WILL NOT overwrite any existing files so make sure to put your base image in its own folder.

1000 words.....

Test folder with 1024 icon (can be named whatever you want)

Launch Automator app and click the Run button...
Browse to and select your 512 icon file
This is where the "magic" happens (lol!)

Completed folder with shiny new icons, yeah!
(Very old image)

In the zip file is a second Automator "application" named "Create iOS Iconset Droplet iOS7". You don't run this application you simply drop your 1024 icon onto it and the magic happens... sweet right? I know... :-]

To use the droplet, just drag the droplet to your Dock. Now when you need a set of icons, place your master image in a folder, then drag it on top of the droplet and give it about 3 seconds and its done. This has a permanent home in my Dock.

Updated: 14-09-2013 - removed the "[ ]" in the name - this caused a problem for some on the droplet. No need to re-download, simply rename and remove the brackets. Thanks @Dragyn at cocos2d forums!

Download link: CLICK ME

Friday, August 16, 2013

Replacement AlertView and ActionSheet

Give that iOS 7 has totally hosed any hope for custom AlertViews I hacked up a couple of nice options available on github.

Here's the finished product in a sample project.

DISCLAIMER: THIS SUITS MY NEEDS, if it doesn't suit your needs, sorry, look elsewhere...


LICENSE: matches the github MIT EXCEPT for Alex1987 - go use your fancy frackin' TSAlertView, 'mm-kay! ;)

DOWNLOAD LINK

:-)

Example of what you do by subclassing this:


This was accomplished just like how you'd do it pre-iOS 7 (code snip it below)

- (id)initWithTitle:(NSString *)title yoffset:(int)yoffset minValue:(int)minValue setValue:(int)setValue maxValue:(int)maxValue message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle okButtonTitle:(NSString *)okButtonTitle image:(NSString*)imageName {

self = [super init];
if (!(self = [self initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:okButtonTitle, nil])) return nil;
    CGFloat xCenter = kTTMaxContentFrameWidth * 0.5f;
    
    self.mySlider = [[UISlider alloc] initWithFrame:CGRectMake(xCenter-110, kSliderOffsetForY, 220, (kIsAniPad ? 48.0 : 36.0))];
    self.mySlider.minimumValue = (float)minValue;
    self.mySlider.maximumValue = (float)maxValue;
    self.mySlider.tag = 0;
    if (yoffset == -1) {
        self.mySlider.value = 0;
    }
    else {
        self.mySlider.value = (float)setValue;
    }
    
    self.mySlider.continuous = YES;
    [self.mySlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
    
    // Setup custom slider images
    UIImage *minImage = [UIImage imageNamed:@"leftSide.png"];
    UIImage *maxImage = [UIImage imageNamed:@"rightSide.png"];
    UIImage *thumbImage = [UIImage imageNamed:@"thumb.png"];
    UIImage *thumbPressedImage = [UIImage imageNamed:@"thumbpressed.png"];
    
    minImage=[minImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
    maxImage=[maxImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
    
    // Setup the sliders
    [self.mySlider setMinimumTrackImage:minImage forState:UIControlStateNormal];
    [self.mySlider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
    [self.mySlider setThumbImage:thumbImage forState:UIControlStateNormal];
    [self.mySlider setThumbImage:thumbPressedImage forState:UIControlStateHighlighted];
    [self.containerView addSubview: self.mySlider];

    if (minValue == maxValue) {
        self.mySlider.hidden = TRUE;
}
    
self.myLabel = [[UILabel alloc] initWithFrame:CGRectMake(xCenter-120, kLabelOffsetForY, 240, 22)]; //20
self.myLabel.backgroundColor = [UIColor clearColor];
self.myLabel.textColor = [UIColor blueColor];
self.myLabel.font = kTTAlertSliderFont;
self.myLabel.textAlignment = UITextAlignmentCenter;
self.myLabel.text = [NSString stringWithFormat:@"Selected Amount: %i", (int)self.mySlider.value];

if (yoffset == 23) {
self.myLabel.text = [NSString stringWithFormat:@"Selected Amount: %i", (int)self.mySlider.value];
}
else {
self.myLabel.text = [NSString stringWithFormat:@"Selected Amount: %i", setValue];
}
[self.containerView addSubview:self.myLabel];
NSString *imagePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"Alert/%@", imageName]];
    CGRect iframe = CGRectMake(8.0, 12.0+yoffset, 156.0, 60.0);
    if (kIsAniPad)
        iframe = CGRectMake(12.0, 14.0+yoffset, 312.0, 120.0);
    
self.myImageView = [[UIImageView alloc] initWithFrame:iframe];
self.myImageView.image = [UIImage imageWithContentsOfFile:imagePath];
    
[self.containerView addSubview:self.myImageView];    
    
return self;
}

- (void)alertView:(TTAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
pressedButton = buttonIndex;
}

Friday, June 21, 2013

Cocos2d with iAd bannerView

I finally got around to cleaning up my base code I've been using in nearly all my cocos2d apps. This will jump start your project to include an iAd banner (top or bottom, set by macro) along with a few other items.

Feel free to check it out.

Screenshot:


Download Project file HERE.