开发者

Question of Objective C on iphone

开发者 https://www.devze.com 2023-01-19 06:47 出处:网络
-(void)touchesBegan :(NSSet *)touches withEvent:(UIEvent *)event { [textValue resignFirstResponder]; [super touchesBegan:touc开发者_如何学JAVAhes withEvent:event];
-(void)touchesBegan :(NSSet *)touches withEvent:(UIEvent *)event
{
 [textValue resignFirstResponder];
 [super touchesBegan:touc开发者_如何学JAVAhes withEvent:event];
}

can someone explain me the meaning of this method???


[textValue resignFirstResponder];

Usually used to hide the keyboard if textValue control has focus at the moment.

[super touchesBegan:touches withEvent:event];

Calls the same method of parent class to preserve standard touch handling.


From the documentation;

Tells the receiver when one or more fingers touch down in a view or window.

The primary event-handling methods for touches are touchesBegan:withEvent:, touchesMoved:withEvent:, touchesEnded:withEvent:, and touchesCancelled:withEvent:. The parameters of these methods associate touches with their events, especially touches that are new or have changed and thus allow responder objects to track and handle the touches as the delivered events progress through the phases of a multi-touch sequence.

0

精彩评论

暂无评论...
验证码 换一张
取 消