control array in xcode
I am quite new to Xcode and still do not know a lot of things Xcode can do. I wanna ask if Xcode or Objective-C uses Control Arrays like VB6.
edit: posted question on seperate page.
How to detect which label or image is selected when they are created dynam开发者_如何学运维ically
No, Xcode and Obj-C have nothing like control arrays, even though it would be pretty easy to replicate that behavior if you needed to. If you have a specific task you'd like to accomplish, post a question and we may be able to give you a more specific answer.
we have control array.... you can declare like UILabel *lblName[numberOfLabelsYouWant]
yes but I think what would be useful would be something like: IBOutlet UILabel* labLicense[20];
which generates a compile time error.
If you are asking how to detect which label or image is selected which are created at runtime, then:
Assing tags to the labels/images while creating through code.
Write a method which will be invoked when a particular image/label is pressed.
Pass the id of the sender when invoking that method.
When the invoked method is called,write the code for a particular tag of an image or label (you can use switch case here).
That's it.
精彩评论