- Create a New button and bind a point-and-click event
1 //Create a Button object, initialize the position size (position coordinates are the upper-left and lower-right corner points)2UIButton *btn = [[UIButton alloc] Initwithframe:cgrectmake ( -, -, -, the)];3 4 //Set button display text and style5[BTN Settitle:@"Test"Forstate:uistatecontrolnormal];6 7 //Binding Events8 //The scope object of the function that the ID and event binds to, typically the view object to which the button is joined9 //Sel- type Object for SEL-bound event functionsTen //forControlEvents The events that are bound One[Btn AddTarget: (ID) Action: (SEL) forControlEvents: (uicontrolevents)]; A - //Adding a Button object to the View - //Self is the View object and view is the view member in the Views object the[Self.view ADDSUBVIEW:BTN];
IOS Cocoatouch UIKit Framework