All Click events and status summaries for UIButton

Source: Internet
Author: User
Tags touch

Uicontroleventtouchdown
Uicontroleventtouchdown: Single Touch Press event: The user touches the screen, or when a new finger falls.

Uicontroleventtouchdownrepeat
Uicontroleventtouchdownrepeat: Multi-touch press event, touch count greater than 1: when the user presses the second to third or fourth finger.

Uicontroleventtouchdraginside
Uicontroleventtouchdraginside: When a touch is dragged within the control window. Uicontroleventtouchdragoutside
Uicontroleventtouchdragoutside: When a touch is dragged outside the control window. Uicontroleventtouchdragente
Uicontroleventtouchdragenter: When a touch is dragged from outside the control window to the inside.

Uicontroleventtouchdragexit
Uicontroleventtouchdragexit: When a touch is dragged from inside the control window to the outside.

UIControlEventTouchUpInside
UIControlEventTouchUpInside: All touch lift events within the control. Uicontroleventtouchupoutside
Uicontroleventtouchupoutside: All touch lift events outside the control (the touch must start with the inside of the control to send a notification). Uicontroleventtouchcancel
Uicontroleventtouchcancel: All touch cancellation events, that is, one touch is canceled because it has too many fingers, or is locked or interrupted by a phone call. Uicontroleventtouchchanged
Uicontroleventtouchchanged: A notification is sent when the value of the control has changed. Used for sliders, segmented controls, and other controls that take values. You can configure when a slider control sends notifications when the slider is dropped, or when it is dragged. Uicontroleventeditingdidbegin
Uicontroleventeditingdidbegin: Sends a notification when the text control starts editing. Uicontroleventeditingchanged
Uicontroleventeditingchanged: Sends a notification when text in a text control is changed. Uicontroleventeditingdidend
Uicontroleventeditingdidend: Sends a notification when the edit ends in a text control. Uicontroleventeditingdidonexit
Uicontroleventeditingdidonexit: Sends a notification when the edit is finished by pressing the ENTER key (or equivalent behavior) within the text control. Uicontroleventalltouchevents
Uicontroleventalltouchevents: Notifies all touch events. Uicontroleventalleditingevents
Uicontroleventalleditingevents: Notifies all events about text editing. Uicontroleventallevents
Uicontroleventallevents: Notifies all events. Status of Button

UIButton *BT = [UIButton buttonwithtype:uibuttontypecontactadd];//uibuttontypecustom, Uibuttontyperoundedrect; //
[BT settitle:@ "MyButton" forstate:uicontrolstatenormal]; Normal state
[BT settitle:@ "Button1" forstate:uicontrolstatehighlighted]; When touching
[BT settitle:@ "Disbutton" forstate:uicontrolstatedisabled]; is invalid
[BT Settitlecolor:[uicolor Redcolor] forstate:uicontrolstatenormal]; Font color in normal state

Bt.titleLabel.font = [Uifont boldsystemfontofsize:24]; Button font
Bt.titleLabel.shadowOffset = Cgsizemake (1, 1);
Bt.titleLabel.shadowColor = [Uicolor Redcolor];

[BT setimage:[uiimage imagenamed:@ "Normal.png"] forstate:uicontrolstatenormal];
Picture in normal state, only valid under Uibuttontypecustom,uibuttontyperoundedrect
[BT setbackgroundimage:[uiimage imagenamed:@ "Background.png"] forstate:uicontrolstatenormal]; Setting the background map

Uiedgeinsets insets; Set the internal picture spacing of the button
Insets.top = Insets.bottom = Insets.right = Insets.left = 10;
Bt.contentedgeinsets = insets;

Bt.titleedgeinsets = insets; Title Spacing

[BT Addtarget:self
Action: @selector (click:)
Forcontrolevents:uicontroleventtouchupinside]; Add Incident Response

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.