Archive for 'Programming'

Code: BWToolkit

Here’s a nifty-looking resource for your desktop Cocoa development: BWToolkit! A wide selection of handy-dandy classes for jazzing up and speeding along your interface work — and get this, they come with their own Interface Builder plugin to boot:

BWToolkit is a BSD licensed plugin for Interface Builder 3 that contains commonly used UI elements and other useful objects. Using these objects is as simple as dragging them from the library to your canvas or document window.

When I first heard about the plugin architecture in IB 3, I saw a huge potential for improving the developer user experience and lowering the barrier to entry for developers who are new to Cocoa. I hope to have accomplished that with this plugin…

Yes, the various goodies described in the links would be nifty enough on their own — and the latest version is right up to date with Snow Leopard, no less — but we’re quite looking forward to adding our own collection of custom views and the like to Interface Builder … just as soon as we have some spare time. *laugh* *sob* *whimper*. Well, anyways, in the meantime, grab the source from bitbucket and check it out for yourself!

Continue Reading →
1

Library: CocoaREST

Here’s a library that may be of interest if you’ve got a use for RESTful services in your iPhone or desktop app: CocoaREST, a generalized superset/replacement for libraries such as MGTwitterEngine:

Recently I created a set of Cocoa classes that let developers interact with internet services such as Twitter, Facebook, Friendfeed, etc. The initial intent was simply to support Twitter, but as the classes became more generalized, the possibilities grew exponentially…

My library is written so you won’t need to look at my headers more than once (if that). This is the developer’s workflow I envisioned when I began writing the API:

  • Create a task of a certain service (ie, SDTwitterTask)
  • Set the task’s type appropriately
  • Navigate to the service’s API page for that task (let’s use mentions as an example)
  • Read that page and note all optional and required parameters
  • Set any properties (ivars) on the task that you would like to have passed to the API
  • Run the task and await results (or an error)

As you can see, it’s almost completely transparent. That’s the goal, no intermediate complexity, just a simple gateway to a website’s API.

Sounds promising, yes? Introduction to be found here; source and instructions to be found at github; and check out the author’s other open source projects as well!

h/t: cocoa-dev!

Continue Reading →
1

Tools: gDEBugger

So, you serious about improving your Open GL code for the desktop or Open GL ES code for the iPhone? Really serious? Like, “$1000? Pffft! A BARGAIN!” serious?

gDEBugger does what no other OpenGL tool can – lets you trace application activity on top of the OpenGL API to see what‘s happening within the graphic system implementation. gDEBugger saves you time by locating “hard-to-find” bugs caused by the incorrect use of the OpenGL API. Debugging OpenGL applications is faster and your applications are more reliable.
gDEBugger provides you with the application behavior information you need for optimizing application performance. No more redundant or “performance killer” OpenGL calls.
Also, you can perform regression tests to understand changes in visual display, performance and accuracy between different versions of your OpenGL application..

Well, have we got the tool for you: gDEBugger!

gDEBugger does what no other OpenGL tool can – lets you trace application activity on top of the OpenGL API to see what‘s happening within the graphic system implementation. gDEBugger saves you time by locating “hard-to-find” bugs caused by the incorrect use of the OpenGL API. Debugging OpenGL applications is faster and your applications are more reliable.

gDEBugger provides you with the application behavior information you need for optimizing application performance. No more redundant or “performance killer” OpenGL calls.

Also, you can perform regression tests to understand changes in visual display, performance and accuracy between different versions of your OpenGL application…

Indeed. We’d seen this tool mentioned before on the mac-0pengl list, so when we saw news of an iPhone beta, we signed right up for it. And indeed, once you get past the flaky Windowsness of the port, it is a most uniquely functional tool. Check out the tutorial and this article on optimization which is part of the extensive online help.So that’s all very well, and it’s apparently popular, but how does it actually run? Well, we ran it over the very early shell of a little iPhone program we’re working on here, and here’s what it looks like at work:

gDebuggerScreenShot

That’s some pretty detailed information, huh? And on the right there is a sample of the kind of thing it finds for you; apparently we’re calling glGetIntegerv somewhere or other, and it politely tells us

Using “Get” or “Is” functions slows down render performance. These commands force the graphic system to execute all queued OpenGL calls before it can answer the “Get” or “Is” query.

Instead, consider caching relevant state variable values inside your application’s code.

Isn’t that helpful? Learn a new thing every day, yes indeed!

So we would suggest that you should all go out and add it to your toolset immediately if you’re doing any OpenGL work, being uniquely suited to that … but $1000-odd with the maintenance package whatever that is, that’s kinda on the steep side if you’re not actually optimization bound at this exact moment, isn’t it? But we shall see what price point they actually release it at soon enough apparently, the release version is scheduled for sometime in July apparently. And July is close!

Continue Reading →
2

Environment: Ansca

Whilst this isn’t likely to be of great interest to us personally, if you happen to be the scripting type of chap — particularly if you’re fond of Lua — here’s something you may find interesting: a development environment for the iPhone called Ansca and aimed directly at you:

“I hate being a n00b. So I’m just going to get over and say that I am completely lost when it comes to XCode/Cocoa (Apple developer frameworks that use Objective C). I also am not so keen on Objective-C. Can anyone point me in the direction of maybe a book or two?” a befuddled developer asked at the developer site HackintOsh.org on March 17.
“For anyone struggling with XCode/Objective-C, give Ansca Corona a look,” urged Trae Regan, a central Florida iPhone application developer who blogged on the release of the SDK today. “It’s a Lua-based iPhone Development Framework that looks to be very easy to use.”
The Ansca development framework brings a JavaScript or Adobe Flash ActionScript type of language to iPhone applications.

“I hate being a n00b. So I’m just going to get over and say that I am completely lost when it comes to XCode/Cocoa (Apple developer frameworks that use Objective C). I also am not so keen on Objective-C. Can anyone point me in the direction of maybe a book or two?” a befuddled developer asked at the developer site HackintOsh.org on March 17.

“For anyone struggling with XCode/Objective-C, give Ansca Corona a look,” urged Trae Regan, a central Florida iPhone application developer who blogged on the release of the SDK today. “It’s a Lua-based iPhone Development Framework that looks to be very easy to use.”

The Ansca development framework brings a JavaScript or Adobe Flash ActionScript type of language to iPhone applications…

Um, yeah. Right then. Must admit that leaves us so cold we do believe we’re actually superconducting, as we find Objective-C downright enjoyable to work with; but hey if it’s got you fired up, signup for the “early adopter” version is free at the moment and apparently quite popular; there’s also a small gallery of products published with it already.

h/t: MobileGamesBlog!

Continue Reading →
4

Tutorial: MessageUI

My, those bright sparks over at MobileOrchard are just outdoing themselves; the second in their OS 3.0 tutorial series — In App Email, MessageUI — is now up, and you should definitely read it:

This time, we’ll add in-app email to a simple iPhone application using the new-in-3.0 MessageUI framework … with 3.0 and MessageUI, sending messages is straightforward and full featured.

We’ll start with working code for a simple app with a UI containing a single button. We’ll add code that shows the compose-an-email message UI and pre-fills the subject and content when the button is pressed.

We’re going to make a very distinct point of including this in all our app releases from now on — at the very least, an angry user that finds it easy to vent at you directly is much less of a problem than an angry user that gives you a ranting 1-star rating on the App Store, yes? And looking at all the low star reviews that we’ve gotten for any reason other than price, every single one of them is a complete misunderstanding that could have been corrected in seconds had we had the chance to do so, so anything that even might help avoid more of those is completely worth the effort to implement, wethinks!

Continue Reading →
2

Code: TouchSampleCode

Here’s a post with some useful code for detecting higher level touch events that’ll no doubt be useful if you haven’t gotten around to implementing that yourself:

Currently, I’ve coded examples for the following cases (along with the implicit intention to add more):

  • Tap and Hold
  • Tap and Hold with delay
  • DoubleTap and Hold
  • Multi-touch (two fingers) with simple stretch and pinch for zoom and unzoom

The source and example project is up on github; grab and enjoy!

Continue Reading →
0

Library: Core Plot

Here’s an up-and-coming project to keep an eye on: Core Plot, which is — as you could probably guess –

Core Plot is a plotting framework for Mac OS X and iPhone OS. It provides 2D visualization of data, and is tightly integrated with Apple technologies like Core Animation, Core Data, and Cocoa Bindings.

Whilst still a work in progress, it’s good enough to make pretty screenshots with:

DarkGraph

Nicer than you could do yourself in short order, yes? Well, nicer than we could do, definitely. The project is up on Google Code, and there’s a wiki to peruse as well as a discussion group. So if you’ve got some time on your hands to devote to an open source project, we definitely recommend you consider this one!

Continue Reading →
1

UIImagePickerController in 3.0

So, you know what happens if you don’t do an exhaustive test of all the apps you support before a system upgrade? Well, let us tell you what happens if you don’t do an exhaustive test of all the apps you support before a system upgrade. You get emails like this:

Bought this program yesterday. But it crash when I select the camera view. I use OS3 on iPhone. Will there be an update that fixes this problem. ???

Oh, dear. Not only is it embarrassing to ever get any emails like that, in this case it’s particularly poor form as it was very foreseeable indeed that mucking around with the internals of UIImagePickerController as described here would be likely to break with a system revision. Whoops.

On the bright side, it turns out that the bits that throw an exception aren’t actually needed anymore, as the UI has been upgraded quite nicely between system versions; we’d been digging in to hide some annoying background and text which is no longer there, all the UI is fitted into an unobtrusive bottom bar. So, to update the above link, what the view hierarchy looks like in 3.0 is

PLCameraView
   PLPreviewView
   UIImageView
   PLCropOverlay
   UIImageView

and if you’d like to — as we do — insert an overlay between the preview and the controls, for 3.0 it’s simply

- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
   if (!viewController)
   return;

   UIView* controllerViewHolder = viewController.view;
   UIView* controllerCameraView = [[controllerViewHolder subviews] objectAtIndex:0];
   UIView* controllerPreview = [[controllerCameraView subviews] objectAtIndex:0];
   [controllerCameraView insertSubview:self.overlayView aboveSubview:controllerPreview];
}

Considerably simpler. And it’s probably an OK bet that as the hierarchy has stayed with the preview image view as the first (bottom) child of a PLCameraView for two major revisions now, this same insert code should continue to work for the future now that we’re not doing any direct messing with any of the other views. Of course, anything that isn’t specifically documented is never guaranteed … so the real lesson here is, make SURE that you keep a list of anything even VAGUELY questionable you do and make sure you test it thoroughly between System revisions so that you don’t get blindsided by rightfully annoyed customers the day after release!

Continue Reading →
0

Tutorial: NSUndoManager

Happy New iPhone Day, everybody! And as the first in what’ll no doubt be a veritable tsunami of OS 3.0 SDK-related posts, Mobile Orchard is promising a series of “New in iPhone 3.0″ tutorials, and the first one is the definitely worthwhile Shake To Undo/Redo, NSUndoManager:

Undo/redo capabilities are provided by the NSUndoManager class. The class, documented here, works by keeping a stack of messages that, if sent, would serially undo the last action, the penultimate action, and on back until arriving at the initial state.

Let’s use an example to illustrate how this works: our city, concerned with a perceived increase in the number of trucks plying our streets, has commissioned a census. City workers will tally truck traffic using an iPhone app. See a truck, tap a button. Oops! Mistook that Subaru Forester for a truck? Shake to undo.

We’ll start with working code that lacks undo/redo and add those capabilities…

Read and learn!

Continue Reading →
1

Tips: UITableView

Here’s a selection of UITableView advice and code for you:

Easy custom UITableView drawing

Customizing your UITableView can be really easy. You don’t need custom drawing code. You don’t need subclasses of anything. Cocoa Touch provides all the drawing capability you need, all you have to do is use the right classes in the right ways and provide the layout.

Fast Scrolling in Tweetie with UITableView

Scrolling is the primary method of interaction on the iPhone. It has to be fast. It has to be fast. More than a few developers have asked me how I do it in Tweetie, so I figured I would share a really fast and really clean technique people can adopt in their own apps.

ASKit from Enormego’s open source

ASKit is an easy to use library for your iPhone applications. ASKit provides AppStore styled table views

UITables with Downloaded Images – Easy Asynchronous Code


Multi-threaded programming is hard and should be avoided whenever possible, and in this case Cocoa’s beautiful design came to my rescue: UIView heirachy + URL loading system + delegate design = multi-threaded image loading with no multi-threaded coding!

Drill down table view with a detail view


Using a drill down table view we can display hierarchical data where the last view is responsible of displaying some detail information. This view in which the detail information is displayed can be the same for all the data in the table view (like my last tutorial) or it can be different based on the path that the user took. In this tutorial I will show you how to add a different detail view based on the path the user took to get to the last item …

Lots of good stuff there, enjoy!

[EDIT: Check out ABTableViewCell, in Fast Scrolling in Tweetie with UITableView!]

Continue Reading →
1
Page 78 of 97 «...5060707677787980...»