Monthly Archives: August 2015

Ctrl-drag to Create Outlets in Custom Views

If anyone can tell me why Xcode (I’m using Xcode 7 beta 5) works this way, I’d greatly appreciate. I have created custom table view cells in the past and I’ve always control-dragged from my storyboard into the custom class to create the outlets. So, when I went to create outlets for a custom (ui)view I’m working on, I was stumped when I couldn’t ctrl-drag into the .h or .m file to create them (outlets or actions).

[Yes, I have all the relevant custom classes specified in the Identity inspector.]

The workaround is to type in the outlet/action code by hand. Once you have entered in your custom class file, you can connect the outlets/actions by dragging from the little dot (do these things have a special name?) Xcode puts in the line number gutter to the relevant UI element. What a pain in the ass.

</endOfXcodeRantForToday>

WordPress Menu Button on Mobile

A quick note regarding WordPress and its Menu button on mobile devices (mobile Safari for sure, others possibly). I’ve been trying to update this site a little and added a Books page to highlight the book I’m currently reading, along with books I’ve read over the last year. I decided to track the books using Pinterest and figured out how to post a Pin and a Board on a page. I decided I should check my handy work on my iPhone and quickly realized the “Menu” button didn’t work. Hmm…

As it turns out, WordPress updated the CSS tag used for the Menu button in their Twenty Twelve theme’s header.php file. So, if you have a child theme like I do and didn’t know about this update, your Menu button is no longer working.

Fortunately, it’s a very quick fix. Open the header.php in your child theme folder and replace the following line of code:

 <h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3>

with:

 <button class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></button>

The navigation.js file was (also) updated to look for this new tag, which is why <h3> doesn’t work anymore. That’s it, all should be working again.

Gesture Recognizers in iOS 9

I don’t code nearly as much as I’d like to, so keeping up-to-date is always a major challenge. I’m still trying to get up to speed on all the great iOS 8 updates with iOS 9 is right around the corner. So, this is probably not news to you but it was news to me.

Prior to iOS 9, you could have a gesture recognizer (GR) associated with 2 different views. You weren’t supposed to but you could. After wiring the GR to both views, you could add the UIGestureRecognizerDelegate method:

– (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch

return YES, and Bob was your uncle. If you do that in iOS 9, you get a very nice error message stating you were never supposed to do that, it’s now being enforced, and the GR will only be added to the view that first loads it. Having figured that out, okay, no biggie, I removed one of my views from all my GRs and then added “duplicate” GRs to the other view, named them differently so I knew which were which, and wired them to the same action method. All good to go.

P.S. Here’s the relevant Apple Documentation page. Scroll down to:

Gesture Recognizers Are Attached to a View

Every gesture recognizer is associated with one view. By contrast, a view can have multiple gesture recognizers, because a single view might respond to many different gestures. For a gesture recognizer to recognize touches that occur in a particular view, you must attach the gesture recognizer to that view. When a user touches that view, the gesture recognizer receives a message that a touch occurred before the view object does. As a result, the gesture recognizer can respond to touches on behalf of the view.

Oh Garmin…

I’ve been meaning to write out this for a while but this past week finally spurred me into action. It’s been a trying week for some if not all (tri)athletes out there, well, the ones that use a Garmin device, which is just about all of them. Actually, now that I think about it, I guess it was only Garmin wielding athletes that have iPhones. On August 6, Garmin updated their iOS (and Android) Garmin Connect app. This is the app you use to sync all your workouts with Garmin Connect, a task most athletes do before they get in their car to drive home from the workout. You can also view your activities, do some minor editing (like change the name, activity type, etc.), and share them. Well, the latest update was a major cluster, crashing on launch for most or simply not working after launch for the rest. Here’s a screen shot of their latest reviews on the App Store.

Screen Shot 2015-08-10 at 10.21.11 AM

Not that this is anything new for Garmin, most athletes have a love/hate relationship with Garmin. When working correctly, their devices are arguably the best available, particularly the Garmin 920XT. Sadly, getting to “when working correctly” can be a long and painful process. I’m not sure if it’s Garmin’s (perceived?) monopoly of the athlete GPS-based device market or just plain incompetence. My hope is the Apple Watch one day gives them a run for their money, although it certainly can’t do that in it’s current incarnation (although maybe it could on the entry level market).

It took 4 days for Garmin to post an update to their iOS app, which in reality is not that bad given App Review times and it’s over a weekend. I am happy to report the Garmin Connect app no longer crashes on launch and seems to sync with my device, yay! On a slightly less happy note, it appears Garmin still doesn’t understand basic Physics/Math, as they don’t calculate the overall pace correctly on the “laps” tab view. Here’s a screen shot.

IMG_1478

Total Avg. Pace should be 9:18/mi.

You can’t average the “Avg. Pace” paces to get the overall pace for your run (unless you run an exact (integer) number of miles every time). Most people don’t do that, although I have some friends that try. Garmin does correctly calculate the overall average pace in other places of the app, notably the “Dashboard” tab view you get when tapping on an activity. Sigh.

I admit I have absolutely zero experience with the Android version of the Garmin Connect app but it appears you Android guys are far from immune.

Screen Shot 2015-08-10 at 10.25.46 AM

As far as I can tell, Garmin has not yet updated the Android version.