1. A method in an electronic device, the method comprising: receiving a first swipe input through a fingerprint sensor of the electronic device; determining whether a direction of the first swipe input is a first direction; if the direction of the first swipe input is the first direction, deactivating at least a portion of a touch panel; receiving a second swipe input through the fingerprint sensor while at least a portion of the touch panel is deactivated; in response to detection of the second swipe input in a second direction, performing fingerprint recognition based on the swipe information of the second direction; and restricting the fingerprint recognition if the direction of the first swipe input is different from the first direction.