Uncategorized


14
Dec 11

iOS Find the current first responder

Quite often you need to know which control is currently the first responder, for ages i have been rolling the same solution over and over again and I thought it about time that i shared it.

Its basically a category on UIView so you can call:

[self.view findFirstResponder];

Imagine you wanted to make sure the keyboard (or any other editor view) was closed you could:

UIView *firstResponder = [self.view findFirstResponder];
[firstResponder resignFirstResponder];

The code is stupid simple:

UIView+AblebotsAdditions.h

#import 
 
@interface UIView (Ablebots)
 
- (UIView *)findFirstResponder;
 
@end

UIView+AblebotsAdditions.m

#import "UIView+AblebotsAdditions.h"
@implementation UIView (Ablebots)
 
- (UIView *)findFirstResponder
{
    if (self.isFirstResponder) {
        return self;
    }
    for (UIView *subView in self.subviews) {
        if ([subView isFirstResponder]){
            return subView;
        }
        if ([subView findFirstResponder]){
            return [subView findFirstResponder];
        }
    }
    return nil;
}
 
@end

12
Dec 11

.GitIgnore for xCode 4 projects.

xCode git support is great, but if your working in a team or on multiple machines you will want to ignore any user/machine specific files.

In my .gitinore I have:

.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
xcuserdata/

Seems to work pretty well.


8
Dec 11

Collabable OSX Notifications

This is a small OSX application I wrote for Collabable.com


8
Dec 11

Adding Growl support to your OSX application

I recently built a small OSX utility that sits in the menu bar and polls your Collabable account for new discussions, one of the final feature i needed to implement was Growl support.

The brief was simple enough, two type of growl notification were required, a simple digest of all discussions when you first logged in and then a specific “New Discussion” notification when a new discussion came in.

Continue reading →


14
Oct 11

2 new websites released this week!

The company I work for (Ablebots LLC) have released 2 new website this week, pretty exciting times!

Check out:

CodeSpaces.com 

Ablebots.com

Love It!

 


19
Jan 11

Great Customer Service

Twitter profile image for spreedly
@spreedly 01/18/2011 Outage Details: http://bit.ly/hyNBsa
Favorited by @floydyboy on Tuesday 18 January 2011

Published via TweetPress


5
Sep 10

iPad Multi-Touch – in Javascript.

ipad_touches_small.jpg

I recently came across a nice article/experiment from Matt Gemmell (@mattgemmell) where he decided to test how many simultaneous touches the iPad Multi Touch display would register, it turns out its 11 and he put together a pretty impressive demo app to prove it (see the Screen Shot).

At first sight you would think its a pretty complex application to achieve this, i mean all the multi touch stuff and the animation seems quite complex, however anybody who knows the iOS SDK will tell you that this stuff is trivial at best, and while Matt has done a great job of pulling it all together its far from complex.

The SDK that wasn’t mean’t to be

This application got me thinking about the iOS SDK and the fact that Apple originally didn’t want us writing native applications and in fact they wanted us to write Browser based applications in Javascript, HTML5 and CSS3.

Now its pretty clear to me that the native apps we see (in abundance) on the app store like Angry Birds, Twitterific, Pulse, Things, Pages, etc… could be written using JS, HTML5 and CSS3 but they would most definitely be poorer for it, come on, the runtime performance, the slick User Experience, simply can’t be replecated to the same level with an app running inside a Browser! (let the flame war begin)

So on that note i decided to replicate Matt’s Multi Touch application in Javascript, HTML5 and CSS3, so with a little digging around in Apples documentation I found all the Javascript events that expose touches (touchstart, touchend and touchmove) and began hacking!

Now let me say right now that this is one hours worth of hacking and the end goal was to build an application that was comparable to Matt’s, I suspect some of the code could be optimised, in fact I really hope that is the case when it comes to the Canvas drawing methods (but that is another story for another post).

multitouchtest.pngNow for some reason I fully expected the JS version to respond to less touches than the native version but in fact its 11 just like Matt’s Version, I also expected the animation to be less “smooth” and jerky when I was moving my fingers around, and I was spot on. The iPad benefits from multithreading and a graphics rendering pipeline, where the Browser that my app is running in does not so any processing I do to draw, calculate or respond to touch events all happens in the same thread as well as the browsers rendering code, this in a nut shell is the reason why these apps will not compete with Naive apps, I may in the near future re visit this topic and look at using HTML5 Web-Workers which in theory would give me the ability to run background threads, but i suspect that even that wouldn’t help too much for applications that are so closely coupled to the rendering engine.

Anyway, here is the application I wrote (visit it on an iOS device) it works almost exactly like the Original albeit its not as smooth. The source code is all inline (for your convenience) so feel free to take a look (lift, steal, optimise, laugh at, etc…) and let me know what you think.

My Conclusion

The iPad really is a “Magical” device, and with Great tools like Sencha Touch web developers are better placed than ever before when it comes to building native-ish applications, but I really believe that these apps will be the poorer relations to their native cousins. So keep learning Obj-C folks!


3
Nov 09

New IPhone App – TweetExpress

Today Apple approved our 4th IPHone app TweetExpress, it took them almost 3 weeks which was a bit disappointing, but its here now.

TweetExpress allows you to receive Push Notifications from Twitter when a selected friend or mention appears on your Twitter timeline, It’s really great that you can select the Friends your interested in rather than getting all your twitter noise pushed to you ;-)

Check it out at http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=336775839&mt=8 and let me know what you think?


22
Oct 09

IPhone Libraries

Mose developers collect a number of libraries and Open Source code samples during their career, which they use over and over again.

Here is a list of the IPhone code that I use when building apps, please feel free to send me some suggestions for more?

  • TouchJSON
    TouchJSON is parser and generator for JSON implemented in Objective C.
  • Three20
    Three20 is an Objective-C library for iPhone developers, featuring a Photo Viewer, Message Composer, Web Images View, Internet aware table view controllers, Better text fields, HTTP disk cache and URL-based navigation.
  • HTTPRiot
    HTTPRiot is a simple REST library designed to make interacting with REST services much easier. It supports GET, POST, PUSH and DELETE requests and HTTP Basic Authentication. HTTPRiot was inspired by John Nunemaker’s excellent httparty Ruby library.

I also have a personal stash of UIKit extensions which i often re-us, I will put them together for a later post ;-)


21
Oct 09

QuickTweet is Open Source

A while ago we developed a simple Twitter Client to scratch a personal itch I had with the existing clients.

The idea was to have a simple app that loaded really quick and enabled me to post a status update to twitter, using a full screen view that contained just a keyboard and a text box.

I also wanted it to rotate nicely in to landscape when I rotated the IPhone.

Seems simple ey? yet all the good twitter clients have really poor implementations.

This is what the App looks like:

original.jpgoriginal2.jpg

This project will show you how to do the following things:

  • Draw a custom control (TextField)
  • Use a Fliped Transition (settings view)
  • Save and fetch user defaults
  • Custom Rotation logic to position elements manually
  • Animation, the tweet text field animates away when you click Post
  • Integrating with a 3rd party code base (MGTwitterEngine)

Go get the source from http://svn.floydprice.com/OSS/QuickTweet/trunk/