我已经尝试了这么多不同的解决方案,但似乎没有什么移动UITextView从故事板向下编程当我需要它。
- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"cell";
Celleventmain *cellz = (Celleventmain *)[tv dequeueReusableCellWithIdentifier:MyIdentifier];
....
CGRect schedulesNewFrame = CGRectMake(cellz.labe.frame.origin.x,
cellz.labe.frame.origin.y + 200,
cellz.labe.frame.size.width,
cellz.labe.contentSize.height);
[cellz.labe setFrame: schedulesNewFrame];
return cellz;
}
你只是使用约束来解决这个问题。将UITextView放到UITableViewCell.contentView中。并将textView和tableviewcell之间的顶部间距约束为200个单位(或任何你需要的单位)。
你可能还需要关闭cellleventmain的contentView的translatesAutosizingMaskIntoConstraints