Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.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
iPhone自定义单元格-透明标签背景_Iphone_Label - Fatal编程技术网

iPhone自定义单元格-透明标签背景

iPhone自定义单元格-透明标签背景,iphone,label,Iphone,Label,图片胜过千言万语:) 代码如下: // Initialization code UIView *myContentView = self.contentView; UIImage *image = [UIImage imageNamed: @"bg_top.png"]; UIImageView *imageview = [[UIImageView alloc] initWithImage: image]; self.backgr

图片胜过千言万语:)

代码如下:

// Initialization code
        UIView *myContentView = self.contentView;
        UIImage *image = [UIImage imageNamed: @"bg_top.png"];
        UIImageView *imageview = [[UIImageView alloc] initWithImage: image];
        self.backgroundView = imageview;
        [imageview release];
        self.label = [self newLabelWithPrimaryColor:[UIColor blackColor] selectedColor:[UIColor redColor] fontSize:15.0 bold:YES]; 
        self.label.textAlignment = UITextAlignmentLeft; 
        [myContentView addSubview:self.label];
        [self.label release];

    self.textField = [[UITextField alloc] init];
    [self.textField setTextColor:[UIColor grayColor]];
    self.textField.font = [UIFont systemFontOfSize:13.0];
    //self.textField.secureTextEntry = YES;
    [self.textField setKeyboardType:UIKeyboardTypeEmailAddress];
    myContentView.backgroundColor = [UIColor clearColor];
    [myContentView addSubview:self.textField];
    [self.textField release];


问题是如何从标签上去除难看的白色背景并使其透明。

尝试使用以下颜色设置背景颜色:

[self.label setAlpha: 0.0f];
或者将Alpha值设置为0

self.label.backgroundColor = [UIColor clearColor];

希望这样就可以了。

试着用以下颜色设置背景色:

[self.label setAlpha: 0.0f];
或者将Alpha值设置为0

self.label.backgroundColor = [UIColor clearColor];
希望这能奏效。

或者:

[self.label setBackgroundColor:[UIColor clearColor]];
或者:

[self.label setBackgroundColor:[UIColor clearColor]];

总而言之。根据您的所有回答,最佳解决方案是:


总而言之。根据您的所有回答,最佳解决方案是:


已存在执行此操作的UIColor实例:[self.label setBackgroundColor:[UIColor clearColor]];除了上面提到的清晰颜色之外,设置alpha将淡出整个标签。已经存在一个UIColor实例来完成此操作:[self.label setBackgroundColor:[UIColor clearColor]];除了上面提到的清晰颜色外,设置alpha将淡出整个标签。我们需要看到带有PrimaryColor的新标签:另外,您的内存管理似乎有误。我们需要看到带有PrimaryColor的新标签:另外,您的内存管理似乎有误。