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.
精彩评论