How to identify view objects in a UIScrollView?

I have a UIScrollView with plenty of objects and I want to identify each of them. I currently do the following:

[learnLabel setTag:currentScrollElements];    
[learnStartButton setTag:currentScrollElements+10000];
[learnLike1Button setTag:currentScrollElements+20000];
[learnLike3Button setTag:currentScrollElements+30000];
[learnCommentField setTag:currentScrollElements+40000];


The ideal solution would be a system where can assign the same number twice to two different objects (to a UIButton and a UILabel for example). I do not want to run out of space, because the max value of tags is the same as the max value of an integer. How can I do this?


May be you can store all object in NSDictionary.

You can do this.

#define LearnLabel          @"LearnLabel"
#define LearnStartButton    @"LearnStartButton"
#define LearnLike1Button    @"LearnLike1Button"
#define LearnLike3Button    @"LearnLike3Button"
#define LearnCommentField   @"LearnCommentField"

NSMutableDictionary* childObjectsDictionary = [[NSMutableDictionary alloc] init];
[childObjectsDictionary setObject:learnLabel forKey:LearnLabel];
[childObjectsDictionary setObject:learnStartButton forKey:LearnStartButton];
[childObjectsDictionary setObject:learnLike1Button forKey:LearnLike1Button];
[childObjectsDictionary setObject:learnLike3Button forKey:LearnLike3Button];
[childObjectsDictionary setObject:learnCommentField forKey:LearnCommentField];

You can use tags without any problem, because it can be used with more views than the possible maximum capability of a device.

Need Your Help

jQuery Dialog But I can't modify the CSS

jquery css

I need to create a Model Popup, but my company is using federated css for things. From what I understand, the jQuery UI requires a very specific CSS/HTML structure to work. Is there another other

How to start debugging this Java error?

java eclipse mule

I'm a student in eclipse, java, and mule. I'm getting an error when trying to Run As--> Mule Server and have no idea what the problem could be. Any suggestions? Much thanks for any advice!!!

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.