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

  関連記事

eyechatch_xcode_tips-300x300
UIButton 同時押し制御

UIButton *myBtn = [UIButton alloc] init] …

no image
iPhone画面サイズ

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

eyechatch_xcode_tips-300x300
【Xcode ObjC #800】Documentsフォルダを見る

iPhone(iPad)のアプリに格納されているDocumentsフォルダを、i …

eyechatch_xcode_tips-300x300
【Xcode ObjC #900】画面の明るさを変更

iPhoneの明るさを変更するメソッド ユーザーの設定している明るさの環境を勝 …

eyechatch_xcode_tips-300x300
Xcode6 GameCenter 実装

Xcode6(iOS7以上)でのGameCenter実装 検索であまり見つからな …

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

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

eyechatch_xcode_tips-300x300
【Xcode ObjC】レビューアラート:SKStoreReviewController

ヘッダーでStoreKitをimport 以下を表示したいタイミングの箇所へ & …

eyechatch_xcode_tips-300x300
.selected

インスタンス名.selected で BOOLを宣言せずにボタンのON/OFF状 …

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

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

no image
乱数のこと

乱数(ランダムな数)を取り出す際 rand や arc4random を使用しま …