UIButton with UITableViewCellSelectionStyleGray Selection Color

后端 未结 3 628
野性不改
野性不改 2021-01-19 14:42

I am trying to set the selected color for a UIButton to the color of \'UITableViewCellSelectionStyleGray\'; The problem is that the selection color of a UIButton cannot be s

3条回答
  •  野的像风
    2021-01-19 15:19

    Try this:

    UIButton    *button =   [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame    =   CGRectMake(50, 50, 60, 20);
    button.backgroundColor  =   [UIColor colorWithPatternImage:[UIImage imageNamed:@"orange.jpg"]];
    [self.view addSubview:button];
    

提交回复
热议问题