我以这种方式创建了一个 textView:
UITextView*txtview = [[UITextView alloc] initWithFrame:CGRectMake(x,y,25,25)];
txtview.backgroundColor = [UIColor clearColor];
txtview.textColor = [UIColor redColor];
txtview.font = [UIFont fontWithName:@"TrebuchetMS-Bold" size:18];
txtview.inputView = segmentKB;
txtview.delegate = self;
[self.view addSubview:txtview];
[txtview sizeToFit];
我的问题是,当我编辑这个 TextView 时,它会向上移动一些像素。
我该如何解决这个问题,为什么会这样?
inputView 是一个分段控件,但是普通键盘也会出现同样的问题。
最佳答案
将 txtview 的高度从 25 更改为 35。
关于iPhone - UITextView 在编辑时改变位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18332664/