Archive for 'Programming'


Ever tried to adapt CoreTextArcCocoa to iOS and decided in short order “nah, the artists can sort this out?” Yep, us too. For next time that situation comes up, there’s a good-looking port of it to be found in this Stack Overflow question:

I adapted the CoreTextArcCocoa sample project, above for my own use, and thought I’d share it here.

I added a few other features as well, such as the ability to set the arc size to something smaller than 180, and the text color and offset shift as properties (so that you don’t have to have a huge frame to show the whole text).

File: CoreTextArcView.m (iOS version)

Abstract: Defines and implements the CoreTextArcView custom UIView subclass to draw text on a curve and illustrate best practices with Core Text…

Yep, that’s some handy stuff. Grab it from the link and give it a voteup!

h/t: @juggleware via @mariozullo!

Continue Reading →

W3i Games Platform

So those W3i people we’ve previously mentioned as having a well worth reading freemium game design series, and a pay per install campaign worth looking into if that’s in your marketing plan (still; the $500 credit mentioned there has been extended on what appears to probably be a permanent basis) are seriously stepping up their engagement levels, it looks like:

W3i opens Games Platform beta for iOS developers

W3i continues to innovate in the mobile space by announcing availability in its Games Platform beta project. The project responds to some key challenges iOS games developers face when embarking in freemium game development.

Interviews with a number of games developers revealed common challenges with freemium game development include: server set-up, maintenance and security, the development of a storefront, and actionable analytics…

… So what are developers doing today to manage all of these challenges? Unfortunately, most are bearing the expense in dollars and resources by themselves and for the analytics, they are simply doing without. W3i can remove these burdens for developers that choose to participate in their beta program. In exchange for feedback on the system, these beta participants receive the service at no charge. To request access, … complete the form and a team member will contact you with details. The number of available openings is limited so act soon!

Screen shot 2011-08-17 at 10.12.07 PM.png

Looks interesting, and hey FREE is always a good price yes? If any of you give this a shot, be sure to let us know what you think!


In May 2012 the Games Platform had an open beta: here’s how to get started, or you can go straight to W3i github to download the SDK!

Continue Reading →

Document Management

Here’s an excellent tutorial for you to read all about, as the title straightforwardly describes,

Importing & Exporting Documents in iOS

One of the common tasks that an iOS developer has to do is to import or export documents from his iOS application. For example, suppose you are developing a document reader and you want to allow the user to import documents into your application so that it can be read offline. Also, your reader might also support the exporting of documents so that other applications can make use of the document.

In this article, I will walk you through the different techniques you can employ to allow documents to be imported or exported from your iOS application…

Covers use of UIDocumentInteractionController to export documents, like having a PDF you write show up in iBooks; how to use File Sharing to have iTunes transfer files into your /Documents; and how to set things up to import documents from other applications, mail attachments, and so forth. Nice piece; haven’t seen all this related stuff grouped together so handily anywhere else!

h/t: maniacdev!

Continue Reading →

AFNetworking + FormatterKit

So as has been generally conventional among the plugged in set we’ve been using ASIHTTPRequest for our heavy lifting network needs the last while, but it seems that teh tweeties are all abuzz lately with a new contender for that job:

Screen shot 2011-08-15 at 11.40.32 PM.png
Screen shot 2011-08-15 at 11.40.50 PM.png

Well, those are rather enthusiastic sounding, aren’t they? So what is this AFNetworking thingy then?

A delightful iOS networking library with NSOperations and block-based callbacks

There’s a lot to be said for a networking library that you can wrap your head around. API design matters, too. Code at its best is poetry, and should be designed to delight (but never surprise).

AFNetworking was lovingly crafted to make best use of our favorite parts of Apple’s Foundation framework: NSOperation for managing multiple concurrent requests, NSURLRequest & NSHTTPURLResponse to encapsulate state, NSCache & NSURLCache for performant and compliant cacheing behavior, and blocks to keep request / response handling code in a single logical unit in code.

If you’re tired of massive libraries that try to do too much…

If you’ve taken it upon yourself to roll your own hacky solution…

If you want a library that actually makes iOS networking code kinda fun…

…try out AFNetworking.

Never thought we’d see “networking code” and “kinda fun” in a concatenation. And we have spent waaaaaaay too much of our lives in writing it, that being pretty much the first task everyone finds obvious to delegate to THE MAC GUY on a cross-platform team, we have found. But why yes, the samples do look like pretty nice simple code, and integrated nicely with JSONKit too. So as long as you can require a minimum of iOS 4 for the blocks, which is rapidly approaching “not a problem” status for new projects, that does indeed look worth a look.

Bonus: The acknowledgements led us to FormatterKit, which looks like quite the handy addition to your bag of tricks as well:

FormatterKit is a collection of well-crafted NSFormatter subclasses for things like hours of operation, distance, and relative time intervals. Each formatter abstracts away the complex business logic of their respective domain, so that you can focus on the more important aspects of your application.

In short, use this library if you’re manually formatting any of the following (with string interpolation or the like):

Arrays: Display NSArray elements in a comma-delimited list (eg. “Russell, Spinoza & Rawls”)

Hours of Operation: Format and collapse recurring weekly business hours (eg. “Mon-Wed: 8:00AM – 7:00PM”)

Location, Distance & Direction: Show CLLocationDistance, CLLocationDirection, and CLLocationSpeed in metric or imperial units (eg. “240ft Northwest” / “45 km/h SE”)

Ordinal Numbers: Convert cardinal NSNumber objects to their ordinal in most major languages (eg. “1st, 2nd, 3rd” / “1ère, 2ème, 3ème”)

Time Intervals: Show relative time distance between any two NSDate objects (eg. “3 minutes ago” / “yesterday”)

URL Requests: Print out cURL or Wget command equivalents for any NSURLRequest (eg. curl “” -H “Accept: application/json”

Code you don’t have to write is always the best kind!


Woah! Yep, it is officially, from the author, time to stop using ASIHTTPRequest as active development has ended. His suggestions for where to look forward:


From the people who make Gowalla. A general purpose HTTP lib, built on modern patterns, actively developed. AFNetworking has been gaining a lot of traction over the last few months, so it’s a good bet that it’s going to be around for a while.


A lightweight HTTP lib, actively developed. Also comes in an ARC-flavoured variety.


For applications that talk to REST-based services, lets you map remote objects and store them in CoreData. It sounds like this could replace a lot of code in the right circumstances.


Amazon S3 support has been one of the most popular ASIHTTPRequest features. These days Amazon offers their own SDK for iOS, providing access to S3, CloudFront, SimpleDB and other Amazon cloud services.


The highest-level API listed here. Provides a simple way to upload content to a variety of services, and a UI to make it super easy to drop into your projects.


From the people who make your cellphone. Built by smart people, lightweight, actively developed. :)


SVHTTPRequest is another simple, fast, blocks, etc. option stressing straightforwardness.

Or try Introducing MKNetworkKit + Advanced Networking with MKNetworkKit.

Another MKNetworkKit vote: ASIHTTPRequest is dead, now what?

And RSOAuthEngine is a lean Twitter implementation for MKNetworkKit.

Say hello to FSNetworking: A Small Networking Library for iOS and Mac

AFNetworking / AFNetworking-ASIHTTPRequest eases the transition.

iOS AFNetworking Add-On Library That Provides Accelerated Downloading

OliverLetterer / AFURLConnectionByteSpeedMeasure “is a drop in extension for AFNetworking to measure download and upload speed of an AFURLConnectionOperation and estimate completion times.”

jboehler / AYNetworking “is a set of category with API methods to make it easier to handle requests and response with AFNetworking Framework.”

AFNetworking Crash Course

jaminguy / JGAFImageCache “A fast reliable image cache for iOS built with AFNetworking.”

NSHipster’s NSFormatter

The Minus Sign: “The default behavior of NSNumberFormatter is to use the hyphen-minus to format negative numbers … your text will look much more professional if you use the real minus sign.”


Alamofire / Alamofire : Elegant Networking in Swift

Alamofire Tutorial Part 1: Getting Started and Part 2: Progress and Caching

SwiftyJSON; Nice Web Services, Swift Edition; Working with JSON in Swift Tutorial; Parsing JSON APIs with SwiftyJSON tutorial series:

UITableView Tutorial in Swift using Alamofire, Haneke and SwiftyJSON and UICollectionView version

Continue Reading →

Complex Gesture Recognition

Have in mind doing something that requires gesture recognition, and found out in short order that’s a pretty tricky thing to do? Here’s an excellent article set for you:

Complex Gesture Recognition in iOS – Part 1: The Research

Complex Gesture Recognition in iOS – Part 2: The Implementation

Or for the ADD-inflicted, source is on github for an iOS $N Multistroke Recognizer implementation!

h/t: ManiacDev — check their post for links to $1 gesture recognizer stuff as well if that’s enough to suit your needs.

Continue Reading →


Here’s a possibly interesting collaboration tool: These people who apparently are Yet Another IM Network, because we certainly don’t have enough of those or anything, are doing their bit to stand out from the crowd by providing an SDK that lets you use their platform to share content from your app:

… By giving your users the ability to share with each other in real time, your app will be that much more fun and compelling (see the Sketchee story below). Sharing can also give a big boost in adoption – when a user who doesn’t have your app receives a Kik content message from it, Kik offers to take them directly to your download page where they can install it. All of a sudden you aren’t asking your users to share your app with their friends, but to share content from your app with their friends – content that requires them to get your app to view and interact with it. It’s the difference between inviting someone to join a social network vs. tagging a photo of them that requires them to join the social network to view it.

And best of all, it will only take you 10 minutes to add this kind of functionality to your app…

That does actually sound like a pretty solid reason to adopt this, if your app has content amenable to being shared, yes. And hey, if that brings some bright spark to mind, and you’ve got a couple weeks at loose ends right now, here’s some decent motivation to check it out:

$5,000 awards for the pioneers

To celebrate our beta SDK release, we want to offer some awards to our early adopter developers. We will be awarding $5,000 to the 3 developers who write and launch the best apps using our SDK before August 8th. Learn more about the awards here

h/t: readwriteweb!


Check out the video in ManiacDev’s post on the subject too.

Continue Reading →

Supporting iCade

So you heard about that iCade thing for the seriously retro iPad vibe?


If you’d like a full review, check out

Thoughts on the iCade (and on using it with Flash games)

but we’d just like to note for your development pleasure this bit, if you’ve already decided that would be a neat thing to support in your games:

So how do you add iCade support on iOS? Luckily someone made a library that makes it super easy: – basically you just add a special view to your main view controller which listens to keyboard events, and that view then sends messages to a delegate when buttons are pushed. There’s really not much more to it…

“Super easy” is a good level of integration complexity, yep.


Adding iCade Support to Your Game

Continue Reading →

Tip: Keyboard Area

As you know if you’ve ever tried it, it’s harder than you’d think it ought to be to figure out just where the keyboard is coming up on the screen. Here’s a tip which looks like a good approach:

Calculating Area Covered by Keyboard

I’ve seen several approaches to this so far, but they often hard code a certain position of the view or sizes. Like assuming that the covered view always reaches towards the bottom of the screen or always has a certain amount of space taken away from it by the status bar, navigation bar and possibly toolbar.

The whole thing gets even more complicated by the fact the the coordinate system of the app’s window is always in portrait even though your app rotates. So is the frame of the keyboard which you can get from an info dictionary in several notifications. I’ll show you the most universally working method I was able to come up with…

Those bars at the bottom are usually the tricky bit, we find. If this actually does handle them properly in just that little bit of code, we’ll be pretty impressed!

Continue Reading →

Bezier Path Boolean Ops

This is a solid series on manipulating NSBezierPaths:

How to implement boolean operations on bezier paths, Part 1

This post will focus on finding intersections between individual bezier curves, and the next will show how to implement the boolean operations based on that. The algorithm presented will be able to handle arbitrary closed bezier paths, including those with holes and self intersections.

If you’re impatient, you can skip straight to the commented source code

How to implement boolean operations on bezier paths, Part 2

This time I’ll show how to conceptually perform the four common boolean operations: union, intersect, difference, and exclusive or…

How to implement boolean operations on bezier paths, Part 3

In this final installment I’ll present the algorithm used to implement the boolean operations…

Beats figuring it all out yourself!

Continue Reading →

Core Text Tutorial

This is a rather nice introductory piece to the somewhat underdocumented Core Text framework to go along with the various bits and pieces we’ve noted before:

How To Create a Simple Magazine App with Core Text

This tutorial will get you started with Core Text by taking you through the process of creating a very simple Magazine application using Core Text – for Zombies!

You’ll learn how to:

  • lay formatted text down on the screen;
  • fine tune the text’s appearance;
  • add images inside the text content;
  • and finally create a magazine app, which loads text markup to easily control the formatting of the rendered text.
  • eat brains! Ok just kidding, that’s only for the readers of this magazine.

Good stuff, good stuff.

Continue Reading →
Page 30 of 99 «...10202829303132...»