An electronic device is provided processor configured to: receive a biological signal of a user; detect whether the electronic device is attached to or detached from the user based on at least the biological signal; and control an I/O device operationally connected to the electronic device based on whether the electronic device is attached to or detached from the user. The invention further provides a method for controlling an I/O device of an electronic device based on whether or not the electronic device is attached to the user.