开发者

@interface in objective c

In the following code what is the function of -(IBAction)setLabelPushed:(id)sender;

#import <UIKit/UIKit.h> 
@interface BasicIPhoneAppViewController : UIViewController 
{ 
    IBOutlet UILabel *myLabel; 
    IBOutlet UITextField开发者_StackOverflow *myTextField; 
} 
-(IBAction)setLabelPushed:(id)sender;
@end 


Actually it is a non-static method. IBAction means that it can be used as a event handler in Interface Builder (it can be linked to some action). You should provide more details, for example the body of setLabelPushed function.


get the value from textfield and show it in the label .I think so......


It is a method you can bind from within the Interface Builder...

http://mobile.tutsplus.com/tutorials/iphone/iphone-sdk-interface-builder-basic-training/


IBAction resolves to "void" and IBOutlet resolves to nothing, but they signify to Xcode and Interface builder that these variables and methods can be used in Interface builder to link UI elements to your code.

If you're not going to be used Interface Builder at all, then you don't need them in your code, but if you are going to use it, then you need to specify IBAction for methods that will be used in IB and IBOutlet for objects that will be used in IB. IBOutlet and IBAction

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜