There are two ways to get control:
1. Iboutlet: Directly drag and drop the required controls to the interface design file *.h between @interface and @end
2. Tag: Set tag to 12, get lable by the following code
uilabel* lable = (uilabel*) [Self.view viewwithtag:];
The call to the button, and also for iOS, is handled in two ways:
1. Implementing event handling via Ibaction bindings
is still a drag control to *.h, enter the Ibaction method name, connect! And within the control interface *.M file implementation:
-(Ibaction) MYBTN2: (ID) sender { [self.mytxt setText:@ "aaa"];}
2. Setting events through code
The reference is first obtained by getting the two methods of the control, and then in the-(void) Viewdidload:
[Self.mybtn addtarget:self Action: @selector (Btnhandler:) forcontrolevents:uicontroleventtouchupinside];
And new method Btnhandler:
-(void) Btnhandler: (UIButton *) sender{ [self.mytxt setText:@ " Yes, that's right . " ];}
IOS Objective-c Learning Note control gets the button call