iosサンプルコード集をまとめ1
1.色をカスタマイズ
UIColor *newColor = [[UIColor alloc]
initWithRed:(float) green:(float) blue:(float) alpha:(float)];
2.ステータスバーを非表示
[[UIApplication shareApplication] setStatusBarHidden: YES animated:NO]
3.横画面
[[UIApplication shareApplication]
setStatusBarOrientation:UIInterfaceOrientationLandscapeRight]
4.画面の変化を検出
orientation == UIInterfaceOrientationLandscapeLeft
5.フルスクリーン
window=[[UIWindow alloc] initWithFrame:[UIScreen mainScreen] bounds];
6.自動的に親ビューのサイズに適応
aView.autoresizingSubviews = YES;
aView.autoresizingMask = (UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight);
7.ボタンを定義
UIButton *scaleUpButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[scaleUpButton setTitle:@"拡大" forState:UIControlStateNormal];
scaleUpButton.frame = CGRectMake(40, 420, 100, 40);
[scaleUpButton addTarget:self
action:@selector(scaleUp)
forControlEvents:UIControlEventTouchUpInside];
8.しビューの背景画像を設定
UIImageView *aView;
[aView setImage:[UIImage imageNamed:@”name.png”]];
view1.backgroundColor = [UIColor colorWithPatternImage:
[UIImage imageNamed:@"image1.png"]];