在xcode中将自定义图像添加到选项卡的背景

在xcode中将自定义图像添加到选项卡的背景,xcode,background,tabbar,Xcode,Background,Tabbar,我的.h文件中有以下文本: CGRect frame = CGRectMake(0, 0, 480, 49); UIView *v = [[UIView alloc] initWithFrame:frame]; UIImage *i = [UIImage imageNamed:@"background.png"]; UIColor *c = [[UIColor alloc] initWithPatternImage:i]; v.backgroundColor = c; [[self tabbar

我的.h文件中有以下文本:

CGRect frame = CGRectMake(0, 0, 480, 49);
UIView *v = [[UIView alloc] initWithFrame:frame];
UIImage *i = [UIImage imageNamed:@"background.png"];
UIColor *c = [[UIColor alloc] initWithPatternImage:i];
v.backgroundColor = c;
[[self tabbar] addSubview:v];
但在最后一行有一个错误:“例如,接收方类型‘viewcontroller’message没有使用选择器‘tabbar’声明方法”

我正在尝试将background.png设置为tabbar视图的背景


我显然遗漏了什么…

没有self.tabbar。您可以获得
[self.tabbar控制器tabbar]
但它是只读的。请看前面的问题:我想您提供的链接谈到了更改实际选项卡栏的背景。我想更改视图其余部分的背景,即选项卡栏上方的所有内容。