Tabs

iPhone&Androidのアプリ制作・デザイン

*

UIViewの背景画像をフィットさせたい

   


UIViewは(UIImageViewとは違い)背景画像のサイズをフィットする機能がないので、image自体をビューのサイズに合わせて再描画する必要がある。

NSString *bundlePath  = [[NSBundle mainBundle] bundlePath];
UIImage  *image;
	
image = [UIImage imageWithContentsOfFile:[bundlePath stringByAppendingPathComponent:@"img/common/Title_Image_Bg.png"]];
	
UIGraphicsBeginImageContext(self.frame.size);
[image drawInRect:self.bounds];
UIImage *backgroundImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
	
[self setBackgroundColor:[UIColor colorWithPatternImage:backgroundImage]];
image = nil;
backgroundImage = nil;

 - Begin, Xcode

  関連記事

no image
UIView

タイトル画面の背景など、新たにビューを追加した場合 UIViewを生成し sel …

no image
SubViewの重ね順を変更する

SubViewの重ね順を最前面に移動する場合 bringSubviewToFro …

no image
アプリの名前をつける

iPhoneのホーム画面に表示される「アプリ名」の付け方 アプリ名の変更には上 …

eyechatch_xcode_tips-300x300
UIBezierPath

UIImageでpngやjpgを指定する方法は、書籍やブログなどで情報を手に入れ …

no image
ステータスバーを隠す方法

Deployment Info の Status Bar Style 下部にある …

eyechatch_xcode_tips-300x300
保護中: [Objective-C] AES/CBC/PKCS7Padding で暗号化,復号化

この投稿はパスワードで保護されているため抜粋文はありません。

eyechatch_xcode_tips-300x300
UIButton 同時押し制御

UIButton *myBtn = [UIButton alloc] init] …

eyechatch_xcode_tips-300x300
よく使うショートカット

Ctrl+6 : 表示中のクラスのメソッド一覧 さらにテキスト入力してインクリメ …

no image
NSLog まとめ

デバッグする時などに、ログを出力する方法としてNSLogを使用します。 文字列を …

no image
iPhone画面サイズ

3.5inch 320 x 480px (Retina 640 x 960px) …