NSErrorクラスのメソッドを使って簡易に作ることができる + (id)errorWithDomain:(NSString *)domain code:(int)code userInfo:(NSDictionary *)dict ↑
NSOperationってCoreAnimationみたいな派手な機能と違って、あまり解説されていない気がするので、使い方を書いておきます。オーディオのアプリケーションでも、読み込んだオーディオファイルの波形の画像をバックグラウンドで作っておいて、出来上がったら表示するみたいな事にも使えると思いますので。(※2008/5/12 記事にNSInvocationOperation等いろいろ修正を加えています。GCなしにも対応のはず。) NSOperationを使う NSOperationのサブクラスのmainメソッドにバックグラウンドで行いたい処理を記述しておき、そのインスタンス(以後、オペレーション)を作成して、NSOperationQueueのインスタンス(以後、キュー)のaddOperationメソッドに渡すと、あとは勝手にバックグラウンドで処理してくれます。キューへ渡した後にオペレーシ
C99からの仕様である long long int 型がiPhoneの実機でもちゃんと使えるか確認してみました。 今回は以下のサイトを参照しつつテストしました。とてもシンプルにまとめて有り、とても読みやすかったです。 プログラミング言語 C の新機能 http://seclan.dll.jp/c99d/c99d05.htm まずは変数の定義と sizeof() でチェック。 unsigned long long int v1, v2; NSLog(@"sizeof() %d %d %d", sizeof(unsigned long long int), sizeof(long long int), sizeof(v1)); 特にエラーとはならず sizeof() の結果はいずれも 8 。 ということでiPhoneでの long long int 型のサイズは 8byte = 64bit。
UINavigationBar は基本的に左右 (leftBarButtnItem, rightarButtonItem) に一つずつしかボタンを配置することができません。 しかし、ちょっと工夫をするとその制限を突破することができます。 (まあ物理的なスペースの関係でせいぜい2つか3つがやっとなのですけどね) 方法その1. UIToolbar を UIBarButtonItem として配置し、その中に UIBarButtonItem を並べる もっとも見た目がキレイに仕上がる方法です。 UINavigationBar の leftBarButtnItem と rightarButtonItem は UIBarButtonItem のインスタンスをそれぞれ1つずつしか代入できませんが、UIToolbar を UIBarButtonItem として作成することで、その UIToolbar に複
処理が終わったら(サンプルでは2秒間のウェイトが入れてある) contentInsets.top = -60 へ戻してやる。すると最初のヘッダが隠れた表示に戻る。なお contentInsets も UIViewアニメーションの対象なので +[UIView animateWithDuration:aniamations:] を使うとヘッダが隠れるまでがアニメーションになる(逆に使わないと一瞬で切り替わり、やや不自然になる)。 コードではヘッダの表示制御用にメソッドを用意してある。こんな感じ。 - (void)_setHeaderViewHidden:(BOOL)hidden animated:(BOOL)animated { CGFloat topOffset = 0.0; if (hidden) { topOffset = -self.headerView.frame.size.heig
実装 まず ViewController に IBAction を追加する。 @interface RootViewController : UITableViewController { CGFloat cellHeight_; } // cell events - (IBAction)didTouchDoitButton:(id)sender; @end 続いて Xib へボタンを追加する。 次にカスタムセルの生成コードに手を入れる。前回は -[UINib instantiateWithOwner:options:] の owner引数に nil を渡していた。これを self(=RootViewController)とする。 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
スワイプの処理 RootViewController にUIGestureRecognier を左右両方向について登録しておく。 - (void)viewDidLoad { [super viewDidLoad]; : UISwipeGestureRecognizer* swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(didSwipeCell:)]; swipeGesture.direction = UISwipeGestureRecognizerDirectionRight; [self.tableView addGestureRecognizer:swipeGesture]; [swipeGesture release]; swipeGesture = [[UIS
1枚の画像を回転させるアニメーションを実現したい。UIView の transform プロパティを使うと非常に簡単にできることがわかった。 サンプル 初期状態。ここで start を押すと ※画像入手元および画像作者 入手元:Arrow, Up icon | Icon Search Engine 作成者: Kyo Tux (ホームページ kyo-tux on deviantART) これを UIImageView.image に設定し、transformプロパティを使って回転させる。こんな感じ。 - (IBAction)start:(id)sender { self.imageView.transform = CGAffineTransformMakeRotation(0); [UIView animateWithDuration:0.2 animations:^{ self.image
Twitter APIの認証 Twitter APIの使用は、現在"BASIC認証"と"OAuth"の2通りの方法が用意されている。が、今年6月(?)でBASIC認証が使えなくなるという噂で、今後はAPIを使用するのにはOAuthを使用する必要が出てくるようだ。 まぁBasic認証はパスワードだだ漏れになっちゃうからやめておこうよ、という話ですかね。 Basic認証 - Wikipedia Code — OAuth iPhoneアプリでTwitter APIを使いたい場合 結構iPhoneのTwitterクライアントアプリってたくさんあるけど、どういう実装なのだろう? 大抵は初回起動時に設定画面でユーザー名とパスワードを入力させて、それを使ってBASIC認証でアクセスしているのではないのかな? BASIC認証を使うAPIアクセスの実装は比較的簡単。(base64エンコーディングを実装せずに
Jacminikブログ人生始まって以来の連日連続投稿企画としてやってきた『Study CoreData』も前回のエントリーで無事終了することができました! それもこれも見てくださったみなさんをはじめ、twitterなどで紹介してくださった方々のおかげです! そして、その『Study CoreData』シリーズは、 おかげさまでな…なんと!7,000 PVを超えました!! この数字は僕にとってはかなりの快挙です! 本当にありがとうございました<(_ _)> また、このシリーズを完結させるためには、様々な書籍やウェブ上で公開された情報を多いに参考にさせて頂きました。 今回はその辺りも含めて、Study CoreDataの簡単なまとめ記事とさせて頂きまっす! 特にオススメのものには★をつけています。 ※以下すべて敬称略、順不同。 1. 参考書籍(CoreData関連) ・Happy Macint
はてなグループの終了日を2020年1月31日(金)に決定しました 以下のエントリの通り、今年末を目処にはてなグループを終了予定である旨をお知らせしておりました。 2019年末を目処に、はてなグループの提供を終了する予定です - はてなグループ日記 このたび、正式に終了日を決定いたしましたので、以下の通りご確認ください。 終了日: 2020年1月31日(金) エクスポート希望申請期限:2020年1月31日(金) 終了日以降は、はてなグループの閲覧および投稿は行えません。日記のエクスポートが必要な方は以下の記事にしたがって手続きをしてください。 はてなグループに投稿された日記データのエクスポートについて - はてなグループ日記 ご利用のみなさまにはご迷惑をおかけいたしますが、どうぞよろしくお願いいたします。 2020-06-25 追記 はてなグループ日記のエクスポートデータは2020年2月28
[追記]大事な手順を書き忘れていました。セルの再利用のための手順を最後に追記しています。 間違ってるかもしれないけど、たぶんこう。 View Templateを選択して、新しいXIBファイルを作成します。 もともとのViewを削除します。 代わりにUITableViewCellを配置します。 適当にセルをデザインします。 名前を付けて保存します。ここではFeedListCell.xibとします。 Xcodeで対応するUITableViewCellを継承したクラスと、View Controller (FeedListCellController) を作ります。 View ControllerはUIViewControllerを継承します(UITableViewControllerではない)。 また、セルをインスタンス変数として保持します。ここではFeedListCellのインスタンスです。
The best drawing tablets are no longer out of reach of the average consumer. Prices have come down significantly. You can find high-end drawing tablets for a few hundred dollars, and we even feature some in this guide selling for under $100. Drawing tablets allow you to draw right on your computer with pinpoint accuracy and speed. Anyone who is a graphics designer, artist or hobbyist will be able
Make sure you have JSON Framework installed first. This is a continuation of Post JSON to a webservice So if you are writting your webservice application and you have to wait a few seconds to make the request and get the response you will notice that your main application gets locked up. This is due to having to wait for the request to complete and nothing else can work till that request is comple
JSON Framework を使って JSON をパースする方法です。まだ、JSON Framework をインストールしていない場合は、前回の JSON Framework の使い方(準備編)からやってみてください。 NSString *jsonData = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:url] encoding:NSUTF8StringEncoding error:nil]; if (jsonData == nil) { // error } else { NSDictionary* jsonItem = [jsonData JSONValue]; } 解析した結果は、NSDictionary と NSArray が混合しているので注意が必要です。JSON によっては最初に NSArray
Objective-C で JSON を解析するフレームワークがあります。この JSON Framework は iPhone でも使えるので早速インストールしてみました。プロジェクト毎に設定する必要があるので忘れないようにメモしておきます。 Google Code から dmg ファイルをダウンロードします。 json-framework – Google Code dmg に入っている SDKs ディレクトリを ~/Library/ にコピーします。もし既に SDKs ディレクトリがあれば中身を全てコピーします。 Xcode を起動してメニューの プロジェクト > プロジェクトの設定を編集 を選択。 ビルド設定の中にある「アーキテクチャ > 追加SDK」をダブルクリックして値の編集画面を出し、「+」をクリックして以下を追加する。 $HOME/Library/SDKs/JSON/$(PL
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く