최신 아이폰 휴대폰 소식을 제공합니다.
CALayer を使うと簡単にビューに影を落とすことができる。 CALayer* layer = self.imageView1.layer; layer.shadowOffset = CGSizeMake(2.5, 2.5); layer.shadowColor = [[UIColor blackColor] CGColor]; layer.shadowOpacity = 0.5; ただこの方法はビューの外側に影を落とせても、ビューの内部には影を落とせない。 どうするか。 CALayer のプロパティを眺めていていると shadowPath に気がついた。このプロパティには CGPathRef を渡すことができる。 @property CGPathRef shadowPath;もしかしてこれを使って任意の場所や形で影が落とせないか。 試しにこんな矩形のパスを作って渡してみた。 CALay
ちょっと前に書こうと思ってて忘れてたネタ。iOSアプリ内で正規表現を使ってごにょごにょしようと思ったらRegexKitLiteを導入するのが一番てっとりばやいのだけど、iOS 3.2以降はFoundation Framework内でも地味に正規表現が使えるようになってきてるのでメモがてら記事にしておく。 NSRegularExpressionSearch Cocoaで文字列中に別な文字列が含まれているかどうかを知りたいときは、NSStringの-rangeOfString:というメソッドを使う。RubyのString#indexみたいな感じで、見付かった文字列がどこにあるかの位置を返してくれる。こんな感じ。 NSString *string = @"I love Udon."; NSRange match = [string rangeOfString:@"Udon"]; if (matc
It is once again that Fridayest of all days, and time for another Friday Q&A. For today's fountain of technical goodness, reader Jay Tamboli has suggested that I discuss how to write unit tests. Setting Up Unit Tests in Xcode I'm not going to cover how to set up unit tests in Xcode, as that's already been well covered in many other places, and I have no special expertise there. For how to set up t
In this tutorial series, our aim is to take the mystery and difficulty out of OpenGL ES 2.0, by giving you hands-on experience using it from the ground up! In the first part of the series, we covered the basics of initializing OpenGL, creating some simple vertex and fragment shaders, and presenting a simple rotating cube to the screen. In this part of the tutorial series, we’re going to take thing
If you’re interested in graphics programming, chances are that you’ve read about OpenGL, which remains the most-adopted API from a hardware and software perspective. Apple has developed a framework called GLKit to help developers create apps that leverage OpenGL and to abstract boilerplate code. It also allows developers to focus on drawing, not on getting the project set up. You’ll learn how all
処理が終わったら(サンプルでは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
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
私の方で企画しましたcocos2d勉強会が6月20日 サイバーエージェント様にて開催されました。 http://atnd.org/events/16032 平日の夕方開始にも関わらず、約130名の登録も頂き 当日大盛況に終わりました。 私は、cocos2d advanced technicsという内容で 1時間20分ほど話をさせて頂きました。 Youtube版はこちらです。 SlideShareでも公開してますよ! Advanced cocos2d View more presentations from Keisuke Hata さぁ、cocos2d本も一緒に購入してcocos2dプログラミングを楽しみましょう! cocos2dで作る iPhone&iPadゲームプログラミング 作者: Steffen Itterheim,畑圭輔,坂本一樹,加藤寛人,高丘知央,株式会社クイープ出版社/メー
最近、CCSendMessageという素晴らしく 便利なクラスを発見したので紹介します。 元記事 そもそもなぜこれがここに来て登場したかというと、 CCCallFuncを使って、 アクションの最後に何かしたいとか、 複数の引数をセレクタに渡して何かしたいとか、 意外と融通が利かないことが多いです。 というか何より、selfとセレクタ渡すのがめんどくさい!! これは私も思ってました。 CCSendMessageはそれを解決してくれます。 CCSendMessageの使い方は、非常に簡単です。 例えば、CCSpriteのオブジェクトをアクションの後に消去したいときを考えて見ましょう。 CCCallFuncならこのように記述するでしょう。 @interface CCSprite2 : CCSprite { @end @implementation CCSprite2 - (void) remov
Unit testing is great because it makes your life easier. Easier to deliver high quality code, and easier to make changes without fear of breaking something! But what might not be so easy is getting started if you’re new to unit testing – and that’s what this tutorial is all about! We’ll cover how to set up Xcode to use three different unit testing frameworks: OCUnit, which is the unit testing fram
Hi, I’m new here. You may know me as @atomicbird on Twitter. Just a few days ago my book Core Data for iOS: Developing Data-Driven Applications for the iPad, iPhone, and iPod touch (co-written with the excellent Tim Isted) was published, and Matt invited me to contribute some Core Data tips to CIMGF. I’m going to start off discussing taking JSON data from a web service and converting it to Core Da
It's Friday again, that Fridayest of days, and this week that means it's time for another Friday Q&A. Samuel Goodwin suggested discussing how NSZombie works, and that's the topic I will discuss today. Zombie Overview As you may recall, an Objective-C object is just a block of allocated memory. The first pointer-sized chunk of that block is the isa pointer, which points to the object's class. The r
2011-06-09 追記 UITableViewCell の Identifier 設定を忘れてたので追記しました。 UINib を使うと簡単に Nib で定義した UITableViewCell が使える。 今回のサンプル: 次に CustomCell クラスの実装(*.m/*.h)を作成する。こんな感じ。 CustomCell.h @interface CustomCell : UITableViewCell { } @property (nonatomic, retain) IBOutlet UILabel* nameLabel; @property (nonatomic, retain) IBOutlet UILabel* dateLabel; @property (nonatomic, retain) IBOutlet UILabel* descLabel; @property
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く