I was wondering how is it possible that use ONE IBOutle开发者_开发知识库t to several objects , for example I have IBOutlet UITextView *myText;
then 3 UItextView on one view , so I want connect all of them with myText !
You can have one NSArray
which you declare as an IBOutletCollection
(instead of IBOutlet
). In order to know what text field you are getting out of the array, you can set a tag on each one in IB and just pull from the array the text fields that match specific tags.
Don't think so. Each UITextView in the one view would be a separate instance of the UITextView class. The myText variable would only be able to point to one instance's memory address at a time.
I'm not sure what you're attempting to accomplish but you might be able to 'fake it' by having all the UITextViews use the controller as their delegate and setting their properties equal to each other when ever changes are detected. (i.e. Every time the controller receives a message about the text property changing it sets all the UITextView objects text properties equal to the changed UITextView's text property).
You can use 1 object and have different tags.
This is inappropriate. However, it's appropriate to hook one IBAction with multiple IBOutlets. So that when different buttons are pressed, they go to the same IBAction. And the IBAction can tell where on earth that triggering is coming from by looking at the (id)sender argument.
精彩评论