2010-06-01から1ヶ月間の記事一覧

UIAlertViewのmessageを左寄せにする方法

http://www.iphonedevsdk.com/forum/iphone-sdk-development/11676-left-align-text-uialertview.html今回も助っ人ガイジンさん大活躍。 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"hoge" message:@"hogehoge" delegate:self cancelButtonT…

文字列比較のお作法

参考:「入門 Objective-C 2.0」 翔泳社 P.139いや〜、はまった…。文字列の比較。ただ単に==演算子で比較してもダメなんですね…。つまり、 NSString *hoge1 = @"piyo"; NSString *hoge2 = @"piyo"; if (hoge1 == hoge2) { // } else { //何を試してもこっちに…

定数定義のお作法

.h

http://www.yosukesugahara.com/diary/objective-c/objective-c-3.html http://blog.livedoor.jp/tek_nishi/archives/1878816.htmlUIScrollViewのサブクラスのdrawRect:メソッド内で生成した変数を、ゲッターメソッドで取り出して利用したかった(UIScrollVi…

UIScrollViewでQuartz2D図形をスクロールさせる方法

http://www.iphonedevsdk.com/forum/iphone-sdk-development/8178-quartz-2d-uiscrollview.htmlUIScrollView内に描画したQuartz2D図形(ラインなど)がスクロールしないという現象に悩まされました。同じdrawRect:メソッド内で生成した他のオブジェクト(UIv…

UIAlertViewにUITextFieldを追加する方法

http://stackoverflow.com/questions/409599/how-to-move-the-buttons-in-a-uialertview-to-make-room-for-an-inserted-uitextfield http://www.iphonedevsdk.com/forum/iphone-sdk-development/1704-uitextfield-inside-uialertview.htmliPhoneにアプリをイ…

UITextFieldで指定したテンキー(UIKeyboardTypeNumberPad)に「DONE」ボタンを付ける方法

http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-keyUITextFieldにはkeyboardTypeというプロパティがあり、下記のような記述でテンキーを指定できます。 textField.keyboardType = UIKeyboardTypeNumberPad; だ…

UITableViewのスタイルをnibを使わずにGroupedに指定する方法

http://developer.apple.com/jp/iphone/library/documentation/UserExperience/Conceptual/TableView_iPhone/CreateConfigureTableView/chapter_5_section_2.html以下のメソッドをUITableViewControllerクラスのサブクラスに実装。 - (void)loadView { UITab…

アクティブな(フォーカスのある)UITextFieldを取得する方法

http://d.hatena.ne.jp/shunsuk/20091127/1259325178なるほど、これを読んで目からウロコでした。 iPhoneのテンキー(UIKeyboardTypeNumberPad)って「DONE」ボタンがないでしょ? http://d.hatena.ne.jp/manmarina/20100621/1277101067 これに「DONE」ボタ…