blog.ericd.net - imagineric : interactive design & technology

My PAW1300T-7V Finally Synced!

itsynced

Living on the east coast of the United States (outside Boston), I had a slim hope that my Casio Protrek PAW1300T-7V would ever receive a signal from Colorado. A night went by when I placed the watch on a South West windowsill to no avail. I read many forum posts online which mentioned the difficulty in syncing from the East Coast.

I checked the next day and saw that the atomic clock and my watch differed by less than 3 seconds. So I didn’t worry a lot about the sync. It was really close.

Last night I went to bed, making sure Auto Sync was turned on. It was. I went to sleep, being on the North East side of the house, where our bed is located in the master bedroom. I figured whatever, it doesn’t matter.

This morning I woke up and looked at the watch face – there were the three bars showing me a sync did indeed take place last night. I checked the R/C status and at 12:05 the sync happened. Wonderful! In the wrong corner of the house and wearing it (not facing a window)… and it worked.

Happy!

Code shelving before a holiday…

It seems that before holidays my list of features coding and bug solutions in mind always grow before holidays. I ruminate on things I want to do and think of solutions to particular bugs. And I have to shelve them until after the festivities are enjoyed.

It’s true.

Right now I’m thinking about VPN and logging into work and accessing the project repository and firing up Xcode. Instead I’m using Wunderlist to document some thinking I have coursing throughout my mind, not wanting to lose them. 

Wine. Port. Mead. Family. Wunderlist. I’ll be 👌. 

iOS Bug: Occluded UIView with CABasicAnimation not redrawn

I have a UIImageView that holds album artwork in a project. When I get a new now playing notification, instead of simply setting the image to the image view, I perform a crossfade. It’s a lot prettier that way. No problems so far.

Here is a snippet of the crossfading code.

Nothing remarkable there. Now… if I add a sliding panel above the UIImageView, and it expands over the image view, and a crossfade is initiated, when the panel slides away later, the image won’t have updated with the new one. It shows the old artwork associated with the previous song. A stale image state. I thought I was going mad for a bit.

I had a suspicion that the image view needed to be visible to perform the redraw update, so I added a small delay to crossfade after the panel responded to my close event. Enough for a tiny sliver of the image view to be visible in the UI before the crossfade was called. It worked.

My final solution: set the panel on top to an alpha value of 0.99 instead of 1.0 – you can’t visually tell that the panel is a tiny bit transparent. This works – I removed the delay thing because that was even more hackish in my opinion.

I have filed this iOS UIKit bug with Apple. My device is running 10.1 and not 10.1.1 – because I didn’t want to potentially change the core OS before my application delivery (just in case it caused a bug or two someplace).

Swift 3: Always display the UITableView scrollbar

I recently had a strange request in regards to a UITableView. You see, the table in a UI could only display 3 rows before scrolling was enabled. Given the minute stature of this table, showing a user that there were more items in it was important. So it was decided that if this table had more than 3 rows in it, always display the scrollbar. The trouble with this was that Apple Human Interface Guidelines and the iOS SDK don’t allow for this behavior. One is able to flash the scrolling indicator, but that’s about it.

So it was decided that if this table had more than 3 rows in it, always display the vertical scrollbar. The trouble with this was that Apple Human Interface Guidelines and the iOS SDK don’t allow for this behavior. One is able to flash the scrolling indicator, but that’s about it.

So the problem here is twofold.

  1. Display the scrollbar upon table reload.
  2. Maintain the visible scrollbar when the table has been scrolled.

These actually aren’t too bad to nail down. You’ll want to set your showsHorizontalScrollIndicator to false. The solution below relies on only having vertical available as we’re going to loop through the table to find a UIImageView (which holds the stretching image used by the table (subclass of UIScrollView)). Set your table up normally beyond this. Make sure you’re using delegates for the table – of course, right?

How do you loop through a table to find it’s scrollbar now?

There you go. This is brittle as HELL. If you don’t turn off the horizontal scroll indicator, you’ll affect it t0o – and make that display in addition to the vertical. Didn’t want that. And it’s brittle because Apple could update the underpinnings of how these things are constructed and this method won’t work accurately anymore.

So this turns the scrollbar on. If a user scrolls it at all, though, it’s going to fade away again. This part is a tiny bit tricky. Since you’ve set up delegates for the table, you can implement a scroll view delegate in regards to scrolling… or namely dragging.

There is the delegate method – and because I had more than one table, I perform a check first. You probably don’t need that. Anyway, we wait 0.7 seconds before turning the scrollbar back on after a drag. If we attempt before, the animation will prevent the scrollbar alpha change to “take”. Here is the helper stuff for the delay call:

So without using a custom scrollbar or subclassed table, you’re able to get what you need to be done. This is most of the code, but the gist of this is to show that it can be done, albeit in a very brittle way that makes me cringe.

 

Microsoft Surface…

It sucks. Hard. My wife purchased one to use for work and she abandoned it not long afterwards. About a day. So it’s been laying around and I have given it a go a few times. 

Every single time it hangs, mysteriously brings up the right-click menu and prevents scrolling, scrolling is highly erratic, etc. It really sucks. 

Apple Watch notification when Mac is unlocked with it.

I appreciate unlocking my Mac using my Apple Watch. It’s convenient. It’s not as robust as some other solutions that use my phone as a beacon and unlock as I approach. But it’s good.

One thing I don’t especially like is when the Mac is unlocked with my watch: I get a temporary notification on the watch telling me the Mac was unlocked. It goes away upon the next wrist raise, but it might be nice to just turn that notification off if possible. Maybe in the next

Maybe we’ll see such a checkbox in a future macOS release.

My mouse suddenly stuck?

by Eric Dolecki 0 Comments

I am currently running MacOS Sierra 10.12.1. I have a magic mouse 2, magic trackpad, Wacom tablet, and a spare magic mouse. Suddenly while working my mouse cursor became stuck in the menu bar above my username. I could shake the cursor with the mouse to enlarge the pointer, but I couldn’t seem to move it.

  • Turned off my Bose QC 35s
  • Turned off my magic trackpad
  • Tried my extra magic mouse
  • Tabbed with my magic keyboard to BT in the menu bar to check battery levels
  • Restarted

Still, the mouse cursor was stuck in place. 30 minutes later I see that my Wacom tablet stylus has rolled onto the tablet and was intercepting all mouse input with the stylus. Flipped it off and I could use my mouse again.

Grrr.

Swift 3: UITableView snap to cells

If you have your UITableViews snap to their cells, you’ll end up with a more refined user experience. This solution I have works with cells that are consistent in their height (static). You could always work with dynamic heights if you wanted to.

As you can see cellHeight is a set float value, it’s there where you would want to determine the dynamic height. This little bit of code makes a UITableView a lot more refined as it doesn’t clip cell contents when a user lifts their finger from a drag.

Swift 3: Distance between two CGPoints

Here it is in Swift 3, it’s a little different. I tried to use hypotf but it didn’t like CGFloat subtraction.