UINavigationBarに画像などを組み込みする方法
//色を変更(アプリに合う色合いにする)
[[self.navigationController navigationBar] setTintColor:[UIColor colorWithRed:0.4 green:0.1 blue:0.1 alpha:1]];
//背景画像(横320px)を変更
UINavigationBar *naviBar = [self.navigationController navigationBar];
UIImage *img = [[UIImage imageNamed:@"navigation.png"] stretchableImageWithLeftCapWidth:0 topCapHeight:1];
UIImageView *imgView = [[[UIImageView alloc]initWithImage:img]retain];
imgView.frame = naviBar.bounds;
imgView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
imgView.layer.zPosition = -FLT_MAX;
[naviBar insertSubview:imgView atIndex:0];
[imgView release];
0 件のコメント:
コメントを投稿