Warning: Use of undefined constant is_robot - assumed 'is_robot' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 594
[XCode]スキャナーで読み取れるバーコード(JANコード・Code39)をフォントで表示する方法と注意点 | Exception Code.
Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

Exception Code.

iPhone、Macと読書が大好き。iPhone・Mac・書評を中心に好きな事を書いていました。今は『ほーくブログ』でブログを書いています。

[XCode]スキャナーで読み取れるバーコード(JANコード・Code39)をフォントで表示する方法と注意点

      2013/09/06

K s BarCodeFont Code39

Passbookなどもそうですが、最近はクーポンや会員証などの電子化をよく目にします。日本ではJANコードが主流で、読み取りのできるスキャナーもほぼJANコードをサポートしています。

そこで今回はiPhoneの画面にバーコード(JANコード)を写してスキャンできるようにする方法を記しておこうと思います。

バーコードをフォントで表現する

ヤマダ電機のアプリみたいに、会員番号がバーコードになっているものがありますが、あれはどうやって表示しているのかが疑問でした。

調べた所、英数字をバーコードで表示できるフォントがあり、それを使えばそういったものが実現できるようです。

いろいろ試してみましたが、以下のフォントがかなり使いやすかったです。

参考
K’sBookshelf フォント/絵フォント Fonts & Dingbats バーコードフォント Code39

・日本人が開発
・マニュアルも日本語
・下に何を入力したかも書かれている
・なんといってもフリーウェア

といった点が素晴らしい!

フォントを表示させる際の注意点 

早速ダウンロードして、XCodeにフォントを設定します。

設定方法はこちらの記事から。

設定が終わったら、フォントの設定をしてやります。今回はこんな感じです。

lblCustomFont.font = [UIFont fontWithName:@"K's-BarCodeFont-Code39" size:60];

ここで注意しなければいけないのが、このフォントはCode39という規格で作ったJANコード「的な」バーコードだということ。なのでスキャナーで読み取らせる場合は頭とお尻に「*」を付けてやる必要があります。

成功するとこんなバーコードが表示されるはずです。

スクリーンショット 2012 12 14 1 28

これを付けないとスキャナーで読めない場合があるので注意しましょう。

 - 開発/プログラム

  関連記事

bloggerXcode-icon-375x375-75.png
[XCode]gitでcommitしたファイル(リモートリポジトリ)を巻き戻す方法

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

結構前からgitを実験的に導入してcommitやpushをしています。とうとう先 …

デスマーチを止める!システム開発の成功に「設計」と「テスト」は欠かせない

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

「デスマーチ」という、IT業界で名の知れた用語があります。 商品知識のない営業が …

bloggerXcode-icon-375x375-75.png
開発したiOSアプリに不具合を見つけた時に緊急で審査期間を早くしてもらう方法

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

先日とうとう恐れていたことが起こりました。黒い怪物が部屋に出たとかそういうことで …

信じられないほど簡単にオブジェクト指向って何?を解決してくれる本

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

「俺がやらなきゃ誰かやる」が合言葉の社会に生きている僕です。分からないことを分か …

[git]Coda2でgitを設定してWordPressのテーマファイルをバックアップする方法

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

ブログのテーマを作り直していろいろしています。家ではiMac、外ではMacBoo …

bloggerXcode-icon-375x375-75.png
[XCode]Title set but using a system Identifierなる警告が出たときの対処法

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

最近iPhoneアプリ開発を始めた@hawk_aです。 StoryBoardを使 …

無料でプライベートリポジトリをゲットできるgitBREAKがかなり使える

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

gitといえばおおよそgithub。しかしgithubは無料でパブリックリポジト …

プログラミングができるだけではプロジェクトは成功しない

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

プログラマーなのに最近は電話対応で1日が終わる僕です。いろんな所でうめき声ととも …

bloggerXcode-icon-375x375-75.png
[XCode]NSNotificationってなに?って人もとりあえずこれだけは知っておくべき

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

異なるクラス間で通知や変数を渡したりできる便利なNSNotificationです …

bloggerXcode-icon-375x375-75.png
[XCode]親子関係じゃないView間で値の受け渡しをする方法

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1854

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1855

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1861

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1864

Warning: Use of undefined constant APP_POST_TYPE - assumed 'APP_POST_TYPE' (this will throw an Error in a future version of PHP) in /home/hawk1/hawk-a.com/public_html/exception_code/wp-content/plugins/post-views/post-views.php on line 1865

@hawk_a 親子じゃないときは、Appdelegateに変数書いてそれを参照 …