iOS how can I package reusable code in a reusable UI widget? Like a heavily modified text widget?
I built a UITextView that has a lot of custom functionality specific to my application (hits webserver for some special macro features, has special autocomplete dictionary, etc...)
I want to reuse this special text entry in multiple screens on my iOS application. How can I neatly package this code up so it can easily be used as simply as a UITextView can be reused?
you can create a class that will have UITextView as a super class and this class will also be the place for implementing your functions to support the custom functionality and further your class will be used directly instead UITextView for availing of the custom functionality .
You put the @interface
block in a .h file and the @implementation
block in a .m file. Then in any file you want to use it in, #import
the .h file at the top (using double-quotes, not angle-brackets).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With