UITextView获取和丢失焦点事件

时间:2013-01-21 12:25:20

标签: iphone

当我的UITextView失去焦点时,如何才能获得活动?我没有找到这样的事件。 (UITextView不可编辑)

1 个答案:

答案 0 :(得分:0)

在代码中使用覆盖touchesBegan

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *) event
{
    UITouch *touch = [[event allTouches] anyObject];
    if ([touch view]==textviewtofocus)
    {
        // textviewtofocus get focus
    }
else 
// textviewtofocus lost focus

}