Archive for July, 2011

18 JulA few tips on how to use open sourced ShareKit easily

Fork me on GitHubJust a quick note on How to use ShareKit open source library a little bit better.

0. Settings for Social Networks
Getting ShareKit first time you need to setup social networks. Nothing difficult because it has so good commented guide in SHKConfig file. I use Git and made a public fork of ShareKit for the Alteprlay. So now when I push back changed code of ShareKit as a submodule every one can see it. And my settings also :)

Despite that a solution is so obvious I still want to share it because it could save you hours to cut your private settings from public Github commits.

Just copy SHKConfig.h file from the lib directory to your source files and remove original one from the project. Then do anything you want with settings and it will always be in your private repository.


1. Activate URL Sharers for text sharing

In the Forismatic app we need to share quotes via Google Reader and make possible to copy quote to the Pasterboard. Both features are disabled by default.

There are several boolean methods in SHKSharer that control whether a derived Sharer can share Text, URL, Image or File. So we can find +(BOOL)canShareText and return YES instead NO. It just works.

Each time you update ShareKit library not depending you use Git or whatever you need to change this parameters again and again. So the right suggestion is Obj-c Categories. Example for Google Reader:

The same way you can deny or allow any service for any content.

3. Support both localization for the target app and ShareKit

An app may have only one active Localizable.strings for each language. ShareKit provides localizations so it has many such strings.

Again, in the Forismatic app we have own localizations and own *.strings. I was surprised when found they compete with ShareKit translation strings. The active one is that one which is last added :)

The simplest solution is just copy those translation content you need to your *.strings and it’ll work. But again it’ll be hard to manage updates, etc. So I suggest more accurate solution.

  1. Rename all ShareKit’s localizations to LocalizableShareKit.strings
  2. Find SHK.m and change NSLocalizedString(key, key) to NSLocalizedStringFromTable(key, @”LocalizableShareKit”, key)

So now it doesn’t compete with your own localizations and gets translations from renamed *.strings.

Don’t forget to push it back to your fork and merge in right way each time you update the lib.

4. Next big thing

The next thing I want implement is to change sharing text depending on which Sharer call it. For example,

  • if it’s Email Sharer I want to attach AppStore link after a quote
  • if it’s Twitter Sharer it may vary of how long a text quote because twitter can contain 140 chars only. So if it’s more than 140 then it’s better to cut the quote and attach a link to this quote.
  • etc.

17 Jul3 ways to unretina iPhone4 @2x images to standard non-retina ones

Since iPhone4 with retina display was released everyone faces to unretina process. So every design is prepared in double size and then need to be scaled to be shown on non-retina displays.

(retina at the right)

I tried a few ways of scaling @2x images to @1x, so I want to share them.


1. Unretiner
First one and the simplest one is to use 3d part software. I tried Unretiner from the Mac AppStore. It does the job fast and easy as one click, but unfortunately not perfectly. And colors are distored. BTW, it’s definitely defined in the app description – “Great for testing out non retina devices before the big painful export from Photoshop.”

This is almost true. Keep going.

2. Automator
Next obvious thought for Mac users is to try to automate the process by your-self. Open Automator and quickly create own Workflow (or download already made one):

  1. “Find Finder Items” and select input folder
  2. “Replace Text” with “Copy Finder Items” to output folder before replace; Setup replace “@2x.” to “.”.
  3. “Scale Image” from Photos group of actions; scale to 50%
  4. “Reveal Finder Items” to see the result.

Your workflow has to look like this one at the right. Just press to execute and get the result in a few seconds.

So it seems working. But try to zoom the result images and you will notice inaccuracies. There are very small and thin inaccuracies with 1–2px width or height. The right one at the right. The one at the left is from Automator.

3. Photoshop
Easy to guess Photoshop is the best way to have scaled images. Except the way to design for retina and non-retina separately. The last one is hardly worth that.

As it was said it’s a “the big painful export ..”. Honestly it’s not always so. :)  


I usually did conversion for each file separately by pressing Cmd-Alt-Shift-S and setting Percent to 50%. It’s just about seconds but Anton (the team designer) showed me better way.

I made a video to show how simplify the whole process with Photoshop’s version of Automator – it’s called Actions (from Window > Actions) and Batch (from File > Automate > Batch).

So you may create an Action for the right scaling and execute it over the folder to get all images 1/2x scaled. And rename all images at once with Automator easily after that.

I’d like to see Apple standard solution of the problem somewhen.

14 JulGPS Speed 2.0 on the AppStore

At last the long-awaited update for GPS Speed​​ is released.
We made entirely new design and a few new features. And more are coming.
The coolest thing we understood and implemented is two modes: 
  • Portrait mode is for hand using. It has a lot of details but interface is smaller, so you need to keep it in hands to use. We call it Hand Mode.
  • Landscape mode has less information but everything is visible from 1–2 meters easily. So you may use it whenever you want. It’s Digital Mode.
Also visit our brand new website and Like the GPS Speed page to let us know you really like it :)

Description
GPS Speed shows approximate speed and direction. 
Use it when you are a passenger or there is no standard speedometer.

BASICS:
✔ 60/180/540 are switched automatically
✔ Kmh/Mph/Knots
✔ Compass
✔ Timer

PRO:
✔ Digital speedometer in horizontal mode
✔ Max speed
✔ Height
✔ GPS signal indicator

Please request any wishful feature, e.g. statistics, signals, sharing, routes, maps, themes.