开发者

XCode/Objective-C, load buttons (and other UI elements) at runtime

Is it开发者_Go百科 possibile to load buttons at runtime without using .xib files and connect the buttons to class properties anyway (without drag&drop)?


With the "load without .xib" statement do you mean "instantiate in the code", right? in such case the answer is "yes, of course":


// interface
@property (retain) UIButton *myButtonProperty;

// implementation

UIButton *tmpButton = [UIButton buttonWithType:...];
...
self.myButtonProperty = tmpButton;


Yes, it is. You can create button object and add it to a view. More details can be found here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜