gpt4 book ai didi

iphone - 将 TextView 动画到顶部并增加高度

转载 作者:行者123 更新时间:2023-11-29 04:45:22 25 4
gpt4 key购买 nike

我有 TableView ,并在页脚中添加了 UITextView。我希望一旦用户点击 TextView ,我的表格 View 就会以动画方式显示到顶部。这是通过下面的代码完成的,但我必须将高度设置为负值。还有其他方法可以做到这一点吗?

- (void)textViewDidBeginEditing:(UITextView *)iTextView {
[UIView animateWithDuration:0.4
delay:0
options:UIViewAnimationTransitionFlipFromLeft
animations:^{
self.myTextView.frame = CGRectMake(8, 4, 200, -160);
self.myTextView.text = @"test";
self.myTextView.font = [UIFont systemFontOfSize:14];
self.myTextView.textColor = [UIColor blackColor];
}
completion:^(BOOL finished){
self.myLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, self.feedbackTextView.frame.size.height + kRunnerTopBottomMargin, kScreenWidth, 20.0f)] autorelease];
self.myLabel.backgroundColor = [UIColor clearColor];
self.myLabel.textColor = [UIColor darkGrayColor];
self.myLabel.text = @"default";
self.myLabel.textAlignment = UITextAlignmentCenter;
self.myLabel.font = [UIFont systemFontOfSize:12];
[self.view addSubview:self.myLabel];
}];

最佳答案

您可以调用此方法:

    [YourTableView setContentOffset:CGPointMake(0.0f, 0.0f) animated:YES];

关于iphone - 将 TextView 动画到顶部并增加高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9732653/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com