[message setBackgroundColor:[UIColor redColor]];
[message setFrame:CGRectMake(message.frame.origin.x, message.frame.origin.y, message.frame.size.width, 20)];
背景颜色会发生变化,因此 IB 中的连接很好,但 UITextView 的大小不会改变。我尝试了多种方法,但无法改变位置或大小。
如果我从按钮执行操作但不在 didFinishPickingMediaWithInfo 的回调中,它会起作用。
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
[picker dismissViewControllerAnimated:NO completion:^{
[UIView animateWithDuration:0.1
delay:0.0
options: UIViewAnimationCurveEaseOut // Doesnt really matter since its so fast
animations:^{
[message setFrame:CGRectMake(message.frame.origin.x, message.frame.origin.y, message.frame.size.width, 20)];
}
completion:^(BOOL finished){[message setBackgroundColor:[UIColor redColor]]; }];