如何更改表格单元格的详细信息披露按钮的颜色

rdp*_*rdp 12 iphone objective-c ios

我想更改表格单元格的详细信息披露按钮的颜色.提前致谢.

Emp*_*ack 13

您必须创建自定义UIButton并将其设置为单元格的accessoryView.

你的cellForRowAtIndexPath:看起来像下面这样,

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    //...

    if (cell == nil) {

        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];

        UIButton *myAccessoryButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 24, 24)];
        [myAccessoryButton setBackgroundColor:[UIColor clearColor]];
        [myAccessoryButton setImage:[UIImage imageNamed:@"my_red_accessory_image"] forState:UIControlStateNormal];
        [cell setAccessoryView:myAccessoryButton];
        [myAccessoryButton release];

        //...
    }

    //...
}
Run Code Online (Sandbox Code Playgroud)


fui*_*iii 13

更改tableview的色调,单元格也会起作用.