0

I have a UITextField property inside a UIViewController class. I want to allow to set its text using a special method in view controller only. The goal is to move other view controller's elements according to a size of a text inside the text field.

Text field has editing option disabled so it can be setted in code only.

Way 1:

Subclass a UITextField. Looks too extra because I need to set the elements which doesn't belong to this text field. So I need to use a delegate (and as I understand it will be my own delegate only) etc.

Way 2:

Make text field property private. It is my current solution but I don't like that it is fully private.

Can anybody advice a better solution?

user2083364
  • 744
  • 1
  • 7
  • 20
  • 2
    Sorry I didn't get you can you explain more clearly? – Tendulkar Oct 09 '13 at 10:02
  • How about making the `UITextView` an instance variable not a property. And access it via methods or only set the text via methods. Anyway, fully private is not available in objective-c :D – danypata Oct 09 '13 at 11:43
  • to danypata, it is almost the same as my way #2. And even worse. to Tendulkar, ideally I want to make `textView.text` default setter private for all except of one method. And this method belongs to a view controller, not `UITextView`. – user2083364 Oct 09 '13 at 12:09

0 Answers0