0
我在頁腳中添加了UITextView的表格視圖。一旦用戶點擊文本視圖,我想讓我的表格視圖動畫到頂部。這是用下面的一段代碼完成的,但我必須將高度設置爲負值。有沒有其他的方式來做到這一點?使用增加高度將文本視圖設置爲頂部
- (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];
}];