Skip to content

Instantly share code, notes, and snippets.

@jungchris
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jungchris/150896f54c43a46b30a5 to your computer and use it in GitHub Desktop.
Save jungchris/150896f54c43a46b30a5 to your computer and use it in GitHub Desktop.
ViewDidLoad Sets View Using indexOfIdInOrganizationsArray
- (void)viewDidLoad {
[super viewDidLoad];
// NSLog(@"Sponsor #: %li", (long)self.selectedRow);
// set view
NSInteger orgIndex = [SharedConferenceObject indexOfIdInOrganzationsArray:[NSNumber numberWithInteger:self.selectedRow]];
if ((NSNotFound == orgIndex) || (orgIndex >= [SharedConferenceObject.organizationsArray count])) {
// there's a problem ...
NSLog(@"CATCH: SponsorDetailVC array index notFound/bounds for selectedRow: %lu", (long)self.selectedRow);
} else {
// Everything's Ok, display everything wanted
int sponsorLevel = [SharedConferenceObject.organizationsArray[orgIndex] organizationSponsorLevel];
if (sponsorLevel == 1) {
self.imageLogo.image = [UIImage imageNamed:@"badge-bronze.png"];
} else if (sponsorLevel == 2) {
self.imageLogo.image = [UIImage imageNamed:@"badge-silver.png"];
} else if (sponsorLevel == 3) {
self.imageLogo.image = [UIImage imageNamed:@"badge-gold.png"];
}
// display appropriate details
self.labelOrgName.text = [SharedConferenceObject.organizationsArray[orgIndex] organizationName];
self.labelType.text = [SharedConferenceObject.organizationsArray[orgIndex] organizationType];
self.labelDescription.text = [SharedConferenceObject.organizationsArray[orgIndex] organizationDescription];
// other details <snipped> ...
}
}
@jungchris
Copy link
Author

This sets the the user interface view details using the SharedConferenceObject class index. See indexOfIdInOrganizationsArray for further info on this in ConferenceModel.m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment