开发者

How to make transparent UIButton in UITableView Cell

开发者 https://www.devze.com 2023-04-10 15:07 出处:网络
When My .Xib File Is Loaded That Time UITableViewCell is Fill Up With Black Background Color,For That, I am using

When My .Xib File Is Loaded That Time UITableViewCell is Fill Up With Black Background Color,For That, I am using

cell.contentView.backGroundColor = [UIColor开发者_JS百科 blackColor]

But In UITableViewCell One UIButton With "Custom" Button Type Is Generated Programatically so the area Cover By UIButton is a Not transparent (Or Cell background - black Color is Not Display), it is a white color,,,

I Want To Make UIButton With Transparent Background

SO How I Can ?


UIButton *button;
button.backgroundColor = [UIColor clearColor];


try this one it work for me
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button addTarget:self 
                   action:@selector(aMethod:)
         forControlEvents:UIControlEventTouchDown];
        [button setTitle:@"Show View" forState:UIControlStateNormal];
        button.frame = CGRectMake(0.0, 5.0, 160.0, 40.0);
        [button setBackgroundColor:[UIColor clearColor]];
        [cell.contentView addSubview:button];


Why don't you make an image of button along with text you want to show and add this as button background with button type custom.

0

精彩评论

暂无评论...
验证码 换一张
取 消