Trouble with IBOutlet Variable Names [closed]-Collection of common programming errors
I’m having trouble casting a string to exchange for an IBOutlet variable name in my code.
I’m trying to reference an instance of an IBOutlet UILabel that was declared in the header file by programmatically creating the same variable name later on.
However, when I cast an string to try & substitute for the IBOutlet UILabel variable name, the program crashes.
Hopefully, the example below explains what’s happening & why needed. Sorry if the description is a little shaky – I’m a beginner.
When I create UILabel *tempLabelName to try & substitute identically for IBOutlet UILabel *property (referenced in propertyUseForNaming example below) declared in the header file, the program crashes!
for (int i = 0; int < 5; i++)
{
NSString *tempText = [[NSString alloc] initWithFormat:@"%d", [aReferenceObject[i] integerToDisplayAsText]];
UILabel *tempLabelName = [NSString stringWithFormat:@"%@", [aReferenceObject[i] propertyUseForNaming]];
[tempLabelName setText: tempText];
}
Can someone please help me and explain how I can do this/offer further advice?
Much appreciated.