UISwitch下面有详细的文字

时间:2017-06-08 18:17:46

标签: ios objective-c uitableview uiswitch

Text not underneath

我希望能够将描述性文字放在标签下面。以下是我到目前为止的代码:

UISwitch *toggle = [[UISwitch alloc] init];
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"Cell"];
    cell.textLabel.text = @"Remote Execution";
    cell.detailTextLabel.text = @"Remote execution will permit registered devices to execute tests without manually starting them";
    [cell addSubview:toggle];
    cell.accessoryView = toggle;
    [cell.detailTextLabel setAlpha:1.0];
    [cell.detailTextLabel setTextColor:[UIColor redColor]];

1 个答案:

答案 0 :(得分:1)

使用UITableViewCellStyleSubtitle代替UITableViewCellStyleValue1

cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];
相关问题