In my App i’m setting an UITextView as contentView of an UITableViewCell so you can write into it. This is how I set it:
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(cell.bounds.origin.x, cell.bounds.origin.y, cell.contentView.frame.size.width, cell.contentView.frame.size.height)];
[textView setFont:[UIFont fontWithName:@"Arial" size:18.0f]];
[textView setBackgroundColor:[UIColor blueColor]];
[textView setAutocorrectionType:UITextAutocorrectionTypeNo];
textView.text = cell.textLabel.text;
textView.delegate = self;
cell.textLabel.text = @"";
self.textView = textView;
[cell.contentView addSubview:textView];
[textView becomeFirstResponder];
I want to set the textView.text right where the cell.textlabel.text was, but it is a little bit further left and up then the cell text was before. How can I set the cell’s text alignment and/or text offset to the UITextView so the text will be at the same place?
Or…
Set the frame of your textView