Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 为BackbarButtonim创建自定义标题视图_Objective C_Ios_Cocoa Touch_Uinavigationitem - Fatal编程技术网

Objective c 为BackbarButtonim创建自定义标题视图

Objective c 为BackbarButtonim创建自定义标题视图,objective-c,ios,cocoa-touch,uinavigationitem,Objective C,Ios,Cocoa Touch,Uinavigationitem,我正在用PNG制作一个自定义的backbarbuttonim,效果很好。唯一的问题是如何更改文本颜色。我在导航栏上这样做的方式是: CGRect frame = CGRectMake(0, 0, 400, 44); UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease]; label.backgroundColor = [UIColor clearColor]; label.font = [UIFont boldS

我正在用PNG制作一个自定义的
backbarbuttonim
,效果很好。唯一的问题是如何更改文本颜色。我在导航栏上这样做的方式是:

CGRect frame = CGRectMake(0, 0, 400, 44);
UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:20.0];
label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
label.textAlignment = UITextAlignmentCenter;
label.textColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"aColor.png"]];
self.navigationItem.titleView = label;
label.text = @"aTitle";

不要使用自动释放将标签设置为标题视图,在分配后释放标签

        CGRect frame = CGRectMake(0, 0, 400, 44);

        UILabel *label = [[UILabel alloc] initWithFrame:frame];

        label.backgroundColor = [UIColor clearColor];

        label.font = [UIFont boldSystemFontOfSize:20.0];

        label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];

        label.textAlignment = UITextAlignmentCenter;

        label.textColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"aColor.png"]];

        label.text = @"aTitle";

        self.navigationItem.titleView = label;

        [label release];

不要使用自动释放将标签设置为标题视图,在分配后释放标签

        CGRect frame = CGRectMake(0, 0, 400, 44);

        UILabel *label = [[UILabel alloc] initWithFrame:frame];

        label.backgroundColor = [UIColor clearColor];

        label.font = [UIFont boldSystemFontOfSize:20.0];

        label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];

        label.textAlignment = UITextAlignmentCenter;

        label.textColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"aColor.png"]];

        label.text = @"aTitle";

        self.navigationItem.titleView = label;

        [label release];

是否要更改png的文本颜色?是否要更改png的文本颜色?