How do you figure out how many outlets you need by just looking at the finished App Design ?
I know outlet is An ivar that you create and want to connect to an object in a nib file.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The right answer to this is that you don’t care how many IBOutlets you have – the number is meaningless. It’s like asking how many variables I need in my program.
As a few people have pointed out with varying degrees of accuracy, you need an outlet if you need to update a UI element independently of user interaction with that element. Examples would be:
The best advice I can give you is to stop worrying about this and start coding. When you need an outlet it’ll be obvious from the code. You’ll have a user story that needs the UI to be updated and to allow that to happen, you’ll need to add the outlet.
If you really care about the number, you can count them when the app ships to apple and come back to add your own answer here 🙂
disclaimer – the next section for information only, I don’t recommend you do this:
To be accurate, you don’t need any IBOutlets to interact with the UI. You can locate a reference to a control (or any UIView subclass) at runtime using tags. A view’s tag is simply a NSInteger proerty that you can search for in the view hierarchy.
UIViewexposes a method called- (UIView *)viewWithTag:(NSInteger)tagwhich searches all of its subviews for a view with the specified tag. You can either set tags at runtime or in interface builder. Of course using tags is both a runtime (processing) overhead and is more difficult to maintain that using outlets.