我想在单击 TextField 时移动视图,但它仅在textDidChange我们更改文本或编写任何内容时才有效,因此当我们单击 TextField 时如何调用方法。
 -(void)textFieldTextDidChange:(UITextField*)tf{
    [self  showAnimationPests];
}
    -(void) showAnimationPests{
      [UIView animateWithDuration:0.5 
                 animations:^{
                     self.view.frame = CGRectMake(0,-300,1024,768);
                 }];
     }
而不是我想要在文本字段上单击的文本更改
在 .h 文件中
    IBOutlet UIButton*button1;
IBOutlet UIButton*button2;
IBOutlet UIButton*button3;
IBOutlet UIButton*button4;
IBOutlet UIButton*button5;
IBOutlet UIButton*button6;
IBOutlet UIButton*button7;
IBOutlet UIButton*button8;
IBOutlet UIButton*button9;
IBOutlet UIButton*button10;
    @property(nonatomic,retain)IBOutlet UIButton*button1;
    @property(nonatomic,retain)IBOutlet UIButton*button2;
    @property(nonatomic,retain)IBOutlet UIButton*button3;
    @property(nonatomic,retain)IBOutlet UIButton*button4;
    @property(nonatomic,retain)IBOutlet UIButton*button5;
    @property(nonatomic,retain)IBOutlet UIButton*button6;
    @property(nonatomic,retain)IBOutlet UIButton*button7;
    @property(nonatomic,retain)IBOutlet UIButton*button8;
    @property(nonatomic,retain)IBOutlet UIButton*button9;
    @property(nonatomic,retain)IBOutlet UIButton*button10;