开发者

iPhone - Accessing dynamic controls after creation

I'm creating a number of UITextFields dynamically based on fields in the database (inside ViewDidLoad) and would like to know how I can refer to the text fields later?

Normally in Interface Builder I would set an Outlet and then refer to the outlet when I need开发者_开发问答 it, do I need to do the same programmatically?

If not, can I add them to a collection and then loop through them instead?

I'm using MonoTouch, but interested to know how you'd do this the Obj-C way as well.

Many Thanks,

M


Set the tag value, then access it using

UITextField *tf=(UITextField *)[self.view viewWithTag:tagValue];


You can tag them and store them in array and then loop by the tag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜