Category Archives: iOS

UIPanGestureRecognizer starting touch point

The UIPanGestureRecognizer is a very handy gesture recognizer. It gives us velocity, it had various states, and it can form the basis for some interesting interactions in your iOS applications. One thing it’s not very good at is telling the developer the initial touch location for a recognized pan operation.

By the time UIGestureRecognizerStateBegan is fired, the user’s finger has already moved a bit to actually trigger your delegate method. Depending on how fast the user moved the pan initially, that CGPoint could be fairly close or pretty far away from the actual starting position.

I have been working on a system that connects iOS devices and panning on a control application will affect the others in certain ways. And I needed to know the exact starting position even before the panning was recognized. Since I entered the convenient world of gesture recognizers in iOS I had nearly forgotten about touchesBegan, touchesMoved, and touchesEnded.

Pair the UIPanGestureRecognizer with touchesBegan and you’ll have exactly what you need. In my case I had an area to accept the touchesBegan from, so instead of using hitTest I did something like this which works very well:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    CGPoint locationPoint = [[touches anyObject] locationInView:self.view];
    CGPoint viewPoint = [trackPad convertPoint:locationPoint fromView:self.view];
    if([trackPad pointInside:viewPoint withEvent:event]){
        NSLog(@"--> %.2f", viewPoint.y);
    } else {
        NSLog(@"touched outside trackpad");


Wireless charging for iPhone 5 comes when exactly?

I would enjoy a wireless charging system for my iPhone 5 (and potentially a few other devices – a mat large enough for an iPad mini would be extra nice) to make night-time charging at home more elegant. USB cables sprouting from an outlet definitely works but it’s messy looking.

Duracell Powermat

The Duracell Powermat is something what I am after – I’ve checked on their solutions and they have something coming soon™ whenever that is. Anyone have any insight into this? While Binging (I don’t do the Google thing as much anymore – an evil topic for another time), I discovered that Apple has applied for a patent in this arena.

Apple states that their patent covers methods, systems, and apparatus for interacting between a plurality of peripheral devices receiving power wirelessly from a wireless power supply. In one embodiment, a virtual charging area could be created. The virtual charging area will be able to extend to about one meter (3 feet) from a central station that incorporates a NFMR power supply.

Continue reading

iPad mini review

I didn’t receive my 16gb iPad mini until the Thursday after Christmas because it had to be shipped and there was a serious run on them, etc. I had given my old iPad away and I simply restored from an iCloud backup. I have been using it since.

Siri on the iPad is pretty nice. I use it on my iPhone quite a lot, mostly for reminders, appointments, iMessage, etc. when you need it, it’s pretty great. Same on the iPad.

The size. I do have to admit to sometimes missing touch targets every now and then because of the decreased size of UI elements. Nothing major, but even when it happens once its a pain in the ass. The keyboard has never given me problems, it’s areas within applications. So that bit isn’t the most fun. I can put this into a back pocket, with the fear of sitting down forgetting its there. It’s quite portable and every bit an iPad.

The screen. It’s not quite retina, but its something I haven’t noticed very much to be honest. Every now and then I might see some white text on a black background that is small enough to make it blurry. Quite rare. The screen is decent and utilitarian. I have no qualms.

I use the iPad even more now, and I plan on using it at work for taking notes, etc. even more than I do with an iPad 3 that I have kicking around there. Lugging it was always the drawback.

More as I continue to use it, but I love it. Writing this now in landscape on it right now

I hope you had a Merry Christmas!

I hope that you had a Merry Christmas (if you celebrate). Our home just received a new influx of gadgets – our four-year-old daughter received a Nook HD – mainly for books that can read to her and my wife can also record her voice and have that read along with her as well. It’s pretty cute. In terms of hardware, it’s okay. The operating system is pretty smelly, but it’s a cheap device – hence the cheap (free) OS on it. The case we got for it is very nice however. :-) To be honest, this Nook is WAY better than my wife’s abandoned Kindle Fire. Yes, we have a lot of devices in this house… way too many. The Android on the Fire is utter shit. At least the version on the Nook is better in my opinion. Still not great, but better.

I received an iPad mini and the thing rocks hard. It’s superior to the Nook, but our daughter isn’t getting an iPad just yet. We have so much Apple in this house; the only thing missing really is wallpaper and framed photographs of Jony and the Steves. I gave away my iPad to someone who will use it now that I have the mini. I am happy about that. Apple eco-system is complete. Awaiting an upgraded Apple TV or set proper. However that works out.

Verizon data plans (1GB)

When I upgraded and got my iPhone 5 I was informed that my unlimited data was going to be replaced with a 1GB cap per month. I thought that sounded fine.

Now I have found that will simply won’t cut it. Now I’m thinking that at least 2 GB of data is much more appropriate. Think about just the web surfing while you’re out and about. That can easily consume several megabytes of data alone.

The Mobile Book by Smashing Magazine

The ePub version – glorious.

Smashing Magazine has produced a really amazing read: The Mobile Book. While I generally look past books on mobile topics because the mobile space is one that moves and gyrates so frequently and with such large, unpredictable steps. I usually opt to read blog posts on technology/design related sites.

Continue reading

Remove that % battery indicator

If you’re like me you keep your mobile devices charged almost all of the time. Yet you keep that % battery display active – and you start to sweat it when your device gets to x%. Turn that % indicator off and you’ll be surprised how much more relaxed you’ll be in regards to the battery levels. It has made a difference for me.

The new Google Maps

I’ll preface this by stating that I feel that Google has become increasingly evil, contrary to it’s informal corporate motto of “don’t be evil.” I won’t get into that, but generally speaking I have tried to rely less heavily on their services such as mail, search, APIs, and mobile applications.

I installed Google Maps last night just to see what they have done. Turn by turn navigation is present! Just like what Google said they wouldn’t give iOS but keep to the vest for Android users. Whether you like Apple’s Maps application or not, this is a win for Apple as now Google has delivered turn by turn with voice. A more pleasant voice than Siri.

Tapping the positional icon on the bottom left brings up compass mode – which is awesome. Many times in an area you’re unfamiliar with you need to get your bearings before starting out on a navigational route. This really, really helps start you on your way as the map will swing around based on it’s position to north. Well done and very much welcome.

Vectors. Love it. Apple rolled this out and while Google’s vectors don’t look quite as polished as Apples, you get tons more detail at various zoom levels than you do with Apple’s offering.

Overall the experience is as it should be and what we’d expect with Google in this area of expertise. My only nit so far is that when you open the side panel menu and toggle those options on and off, each toggle performs the function and also closes the menu.

So if you want to toggle traffic and satellite imagery on, it’s going to take you four taps – same as if you could just toggle along and close the menu – but it feels like more work. Perhaps they did this so they wouldn’t need a close button. I imagine it is a little cleaner, it just doesn’t feel quite as smooth if you’re wanting to toggle more than one option at a time.

I’ll give this a go. I do use Telenav GPS but that voice sounds annoying and it talks ALL. THE. TIME. Next trip to someplace unknown or fuzzy, I’ll kick Google Maps’ tires.

I finally figured out street view. Haven’t seen the 3D stuff really yet.

Completely custom iOS keyboard class

I am going to be creating from scratch some Classes to create a dynamic on-screen keyboard that needs to be controlled from another application. Controlled with a dPad type of thing. So it will will consume events, display UI navigation of the keyboard, and spit out an event with the character mapped to the activated key, etc.

Does this sound remotely interesting to anyone? This will be a custom UIView type of thing – not accessible and will not respond to touch events. If no one is interested, I won’t worry about so many dynamic bits of it – just get it running well enough for my own particular uses.

UISwipeGestureRecognizer with touchesEnded

Target: iOS
Situation: You have a UIView and it’s set up in your storyboard to detect a swipe gesture (let’s say a direction of right) and it calls a selector in your viewController. You’d like a user to be able to swipe to the right and hold their finger in position and repeatedly call a method (say for scrolling). You need the gesture recognizer to work but you also need to implement touchesEnded in order to kill the NSTimer that’s being used.

A Solution:Set up an IBOutlet for the UISwipeGestureRecognizer. In your viewDidLoad set the following:

swipeRight.cancelsTouchesInView = NO;
swipeRight.delaysTouchesBegan   = NO;
swipeRight.delaysTouchesEnded   = NO;

These are important. The default behavior of a gesture recognizer is to avoid having both it and the view process the touch. So that needs to be fine-tuned. The code above allows for this.

Now the selector (method) is called – whichever you’d like when the gesture is recognized (you set this up in your storyboard – or in code too if you’d like). When that method is fired, you know the direction and you start your NSTimer – to get the repeat effect. When touchesEnded is called in your viewController you can kill that NSTimer (invalidate it) and that’s it. You could use variable flags to determine which timer was being used, etc. if you’d like (different directions).

So you end up with a swipe to the right & hold method that will repeatedly do “something” for the user. A release stops that repetition for the user. Over time you could also change the delay for the timer and have it speed up if “held” long enough.

Pretty cool.