两种设置背景图片方法
// UIView *navigationbarTitleTupian =[[UIView alloc]initWithFrame:CGRectMake(0, 0, 40, 30)];
// UIImageView *imageTitleTupian =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bg.png"]];
//
// [navigationbarTitleTupian addSubview:imageTitleTupian];
//
//
// self.navigationItem.titleView = navigationbarTitleTupian;
// [imageTitleTupian release];
// [navigationbarTitleTupian release];
//第二种视图
UIColor *navigationTitle =[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]];
UIView *navigationTitleView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 40, 30)];
[navigationTitleView setBackgroundColor:navigationTitle];
self.navigationItem.titleView =navigationTitleView;
时间: 2024-10-06 00:16:45