1. Create a custom button
UIButton *btn = [UIButton buttonwithtype:uibuttontypecustom];
2. Add a button
[Self.view ADDSUBVIEW:BTN];
3. Setting the position and size of the button
Btn.frame = CGRectMake (100, 100, 100, 100);
4. Tap the button click (The Btnclick method of self is called when the button is clicked)
[Btn addtarget:self Action: @selector (Btnclick) forcontrolevents:uicontroleventtouchupinside];
5. Set the properties of the button in the default state
5.1. Background of the default state
[Btn setbackgroundimage:[uiimage imagenamed:@ "btn_01"] forstate:uicontrolstatenormal];
5.2. Default state of text
[Btn settitle:@ "point me," forstate:uicontrolstatenormal];
5.3. The text color of the default state
[btn Settitlecolor:[uicolor Redcolor] forstate:uicontrolstatenormal];
6. Set the properties of the button in the highlighted state
6.1. Background of the highlighted state
[Btn setbackgroundimage:[uiimage imagenamed:@ "btn_02"] forstate:uicontrolstatehighlighted];
6.2. Text in highlighted state
[Btn settitle:@ "Touch me what to do" forstate:uicontrolstatehighlighted];
6.3. The text color of the highlighted state
[btn Settitlecolor:[uicolor Bluecolor] forstate:uicontrolstatehighlighted];
iOS Learning--uibutton Common methods (20150122)