1

图片值一千多字:)

替代文字

这是代码:


// 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];

问题是如何从标签中去除丑陋的白色背景并使它们透明。

4

3 回答 3

6

或者:

self.label.backgroundColor = [UIColor clearColor];
于 2009-06-10T13:54:38.747 回答
0

尝试设置背景颜色:

[self.label setBackgroundColor: [UIColor colorWithWhite: 1.0f alpha: 0.0f]];

或将 Alpha 值设置为 0

[self.label setAlpha: 0.0f];

希望能解决问题。

于 2009-06-10T13:13:05.680 回答
0

只是总结一下。根据您的所有回复,最佳解决方案是:

[self.label setBackgroundColor:[UIColor clearColor]];
于 2009-06-11T06:49:40.873 回答