Sprite Bandits

We’ve moved! Update your bookmarks to blog.spritebandits.com

leave a comment »

 

          

We have moved to our own hosting and updating the look and feel. Hopefully you will enjoy the changes.

We will no longer be posting updates at this site, please update your bookmarks and RSS feeds to the new blog at

http://blog.spritebandits.com

Thanks for reading and we’ll see you at the new site!

           http://blog.spritebandits.com/

 

Written by m0rt1m3r

July 16, 2012 at 6:37 pm

Posted in General News

New iPhone app – FlipMe! (promo codes)

leave a comment »

  • Are you trying to learn a new, foreign language?
  • Do you want to memorize new words faster?

Now iPhone app FlipMe! may help.

The app lets you to create your own word cards and assign them to your custom categories. Word cards can be prepared in popular desktop programs such as Excel™, Numbers™ and imported into the application in no time. You can also easily share them with your friends using email.

We’re giving away 5 promo codes that allow you to download the app from the AppStore for free. Drop us an email if you interested.

More details available on the app’s webpage here. Click here or use the banner above to go to AppStore to download the app.

Written by m0rt1m3r

July 2, 2012 at 7:15 pm

Posted in General News, New Releases

Tagged with , , ,

WWDC 2012 session videos available

leave a comment »

Apple Worldwide Developer Conference

WWDC 2012 session videos are now available here for registered Apple Developers.

Servers seem to be very busy now. It’s very hard to get through 🙂

Written by m0rt1m3r

June 20, 2012 at 5:45 pm

Posted in Uncategorized

SQLite Essentials

leave a comment »

I believe SQLite is still a widely used in iOS applications to store various app data, most likely because of the CoreData’s steep learning curve.

Below you’ll find short how-tos describing most common SQLite related tasks:

  1. How to create a new database?
  2. How to drop a database?
  3. How to create an auto increment column?
  4. How to create a date time column with the ‘NOW’ default?
  5. A database example with creation script and a sample data (needed in further examples)
  6. How to read/execute a SQL script file?
  7. How to list a database tables?
  8. How to show a database schema?
  9. How to backup/dump a database?
  10. Working with date/datetime columns (iOS specific)

Read the rest of this entry »

Written by m0rt1m3r

June 11, 2012 at 4:06 pm

Posted in Blog Posts, iOS Development

Tagged with

iOS / Mac developers – help wanted!

leave a comment »

I’m looking for volunteers (authors) willing to help with this blog.

As this is a non profit project so I cannot offer any financial incentives for your contribution, you can get famous though :).

If you like me
– love development
– have experience with iOS/Mac programming
– would like to spread your knowledge around and share you experiences…

Just let me know!

Written by m0rt1m3r

May 9, 2012 at 8:24 pm

Posted in Blog Posts, General News

Tagged with

Tweeting from your iOS 3.1 + apps (ShareKit, ARC and iOS 5)

leave a comment »

Together with iOS5 release we’ve got a great framework to integrate our iOS apps with Twitter. Sending new tweets has never been easier. You can check one of my previous posts here.

But what if your applications are still supporting older iOS versions? It is not as difficult as you may think. The ShareKit based solution described below is the one I’m successfully using with applications that are still running on iOS3.1+.

Read the rest of this entry »

Written by m0rt1m3r

May 1, 2012 at 1:03 pm

Hardening iOS 5 / iOS 5 +security

leave a comment »

            A few weeks ago Australian Department of Defense has Published an interesting guide about iOS 5 security – Hardening Configuration Guide for iOS 5. It covers iOS devices (iPod Touch, iPhone, iPad) running iOS 5.1 or higher. Are you interested? You can download the guide here.

Written by m0rt1m3r

April 23, 2012 at 2:05 pm

Posted in General News, misc., security

Tagged with ,

iPhone – drawing on screen (follow a finger)

leave a comment »

Would you like to draw on the iPhone screen? It’s really simple 🙂
While searching for something completely different I’ve found a very useful post on the topic on stackoverflow (link below). It shows a code sample that lets you to draw lines that follows your finger touching the screen. The approach is simple. You just have to create a new class inherited from UIImageView like the one below:

//
//  Canvas.h
//
#import <UIKit/UIKit.h>

@interface Canvas : UIImageView {
    CGPoint location;
}

@property CGPoint location;

@end

And implement the following touch events:

//
//  Canvas.m
//

#import "Canvas.h"

@implementation Canvas

@synthesize location;

- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];   
    self.location = [touch locationInView:self];    
}

- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    CGPoint currentLocation = [touch locationInView:self];  
    
    UIGraphicsBeginImageContext(self.frame.size); 
    CGContextRef ctx = UIGraphicsGetCurrentContext();   
    [self.image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    CGContextSetLineCap(ctx, kCGLineCapRound);
    CGContextSetLineWidth(ctx, 5.0);
    CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 1.0);
    CGContextBeginPath(ctx);
    CGContextMoveToPoint(ctx, location.x, location.y);
    CGContextAddLineToPoint(ctx, currentLocation.x, currentLocation.y);
    CGContextStrokePath(ctx);
    self.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    location = currentLocation;
}

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    CGPoint currentLocation = [touch locationInView:self];
    
    UIGraphicsBeginImageContext(self.frame.size);
    CGContextRef ctx = UIGraphicsGetCurrentContext();   
    [self.image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    CGContextSetLineCap(ctx, kCGLineCapRound);
    CGContextSetLineWidth(ctx, 5.0);
    CGContextSetRGBStrokeColor(ctx, 1.0, 0.0, 0.0, 1.0);
    CGContextBeginPath(ctx);
    CGContextMoveToPoint(ctx, location.x, location.y);
    CGContextAddLineToPoint(ctx, currentLocation.x, currentLocation.y);
    CGContextStrokePath(ctx);
    self.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    location = currentLocation;     
}

@end

If you not sure how to put all this together in a working app you can download a fully working project here (GitHub).

No one can take this from me… I am a real artist 🙂

The solution works fine but it’s rather unusual to draw inside the touch events. The preferred way is to store new points/lines in an array and draw everything inside the drawRect method.

Something to do… if you wanna play 🙂
– implement a clear screen/rubber feature,
– fading out the line.

References:
How do I use UIBezierPath to draw a line that follows a touch event?

Written by m0rt1m3r

April 17, 2012 at 4:38 pm

Quickie #7 – Deferring viewWillAppear until UIWebView is loaded

leave a comment »

Loading a page into a UIWebView often results in the html content being visible rendered, even when we’re reading data from a local source. In most cases it is something we want to avoid.

 

To overcome the issue we can do the following:

1. Hide our UIWebView (ourWebView) by setting its hidden property to YES:

[ourWebView setHidden:YES];

2. Set our view’s view controller as ourWebView delegate:

ourWebView.delegate = (id) self;		//self - UIViewController

3. Implement – (void)webViewDidFinishLoad:(UIWebView*) webView method:

- (void)webViewDidFinishLoad:(UIWebView*) webView {
    [self.infoWebView setHidden:NO];
}

4. Load the content:

[ourWebView loadHTMLString:htmlString baseURL:baseURL];

Please note: if you HTML content uses frames the webViewDidFinishLoad method will be invoked multiple times.

A small disadvantage of this approach is that it results in a blank screen being displayed until the html content is fully loaded and rendered. To improve user experience, we can display a different, static view in the background. We can also play with colors so the intermediate view’s background color matches the background color of the content that’s being loaded. We can also use other displayed controls to provide a feedback to the user. For example we could display “Loading…” text as a button title, while the content is being loaded and rendered, and replace it when it finishes:

    

 

Written by m0rt1m3r

April 10, 2012 at 1:57 pm

Posted in iOS Development, Quickies

Tagged with , ,

Insides of Apple’s Headquarters – Cupertino, California

leave a comment »

Do you want to know how insides of Apple’s Headquarters look like?

The applegazette has recently posted a few interesting photos: http://bit.ly/HBWwLe.

Written by m0rt1m3r

April 9, 2012 at 6:30 pm

Posted in General News

Tagged with