Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set "User Defined Runtime Attributes" in code

Tags:

xcode

ios

This may be a silly question but I couldn't find an answer anywhere. If I want to create a UIButton in code and need to set a runtime attribute how would I do so without the interface builder and strictly in code?

like image 686
Michael Bailey Avatar asked Nov 08 '13 17:11

Michael Bailey


1 Answers

Actually figured this out, like I said silly question.

[UIButton *loginbtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[loginbtn setValue:@"blah" forKey:@"myAttr"];
like image 75
Michael Bailey Avatar answered Sep 30 '22 17:09

Michael Bailey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!