Dynamically Assigning UITextfield outlets

Just a quick (hopefully!) question for some of you more experiance people out there....

In my view I have about 6 textboxes, however, due to the way my app works I do not want to have to create an individual outlet for each one... I was wondering how you go about re-assigning a different textbox to the one outlet you have? Thanks!

I second that. The quicker you can ween yourself off of Interface Builder the better. It's great when you're starting out, but it soon becomes easy to imagine the layout programmatically. Coding everything is much more flexible.

Staff Member

Interface Builder usage is mostly a matter of opinion. Mostly. Some people, like johnnyjibbs, try to avoid it. Others consider it just another tool in their arsenal. Sure, there are some things you can't do with IB but it does have other advantages. If you feel comfortable using it and are working alone, no need to ween yourself off it. If you are working as a team, the team needs to decide whether to keep it or lose it. Hope that helps.

the more interesting part will be keeping track of the id's of all the TextFields. You might just keep an array for those. And then create the textfields programatically and keep the id's in your array.

Or if you are using IB, then tag the textfields and look them up that way and put them into an array after the Nib is loaded.

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.