单元的子视图不适合UITableView的框架

时间:2017-04-11 10:15:41

标签: ios objective-c uikit

当我点击UITableViewCell时,我正试图这样做,其下面的子视图带有UIDatePicker。框架没有调整大小,我不知道如何做到这一点。这是一张照片,你必须向下拖动才能看到UIDatePicker(在时间模式下设置)。

    CGRect frame = CGRectMake(0, cell.bounds.size.height, self.view.bounds.size.width, 100);
    UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:frame];  // which should be 'now' right?
    pickerView.datePickerMode = UIDatePickerModeTime;  // which creates just the clock
    [pickerView setDate:[NSDate date]];
    //[pickerView addTarget:self action:@selector(updateTextField:) forControlEvents:UIControlEventValueChanged];
    pickerView.clipsToBounds = YES;

    [pickerView setValue:[UIColor whiteColor] forKey:@"textColor"];

    [cell addSubview:pickerView];
    [self.firstTable sizeToFit];

enter image description here

0 个答案:

没有答案