// // ActorIntegrationProfileOptionTableViewController.m // TFBrowser // // Created by JB Meyer on 1/20/10. // Copyright 2010 __MyCompanyName__. All rights reserved. // #import "ActorIntegrationProfileOptionTableViewController.h" #import "ActorIntegrationProfileOption.h" #import "ActorIntegrationProfile.h" #import "Actor.h" #import "IntegrationProfile.h" #import "IntegrationProfileOption.h" @implementation ActorIntegrationProfileOptionTableViewController @synthesize actorIntegrationProfileOption ; /* - (id)initWithStyle:(UITableViewStyle)style { // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. if (self = [super initWithStyle:style]) { } return self; } */ /* - (void)viewDidLoad { [super viewDidLoad]; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; } */ - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"section :%d, row : %d",indexPath.section , indexPath.row ) ; if ( indexPath.row == 2 ) { UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:17.0]; CGSize constraintSize = CGSizeMake(280.0f, MAXFLOAT); CGSize labelSize ; if (actorIntegrationProfileOption != nil ) { switch (indexPath.section) { case 0: if ( actorIntegrationProfileOption.actorIntegrationProfile.integrationProfile ) labelSize = [actorIntegrationProfileOption.actorIntegrationProfile.integrationProfile.tfDescription sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap]; break; case 1: if ( actorIntegrationProfileOption.actorIntegrationProfile.actor ) labelSize = [actorIntegrationProfileOption.actorIntegrationProfile.actor.tfDescription sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap]; break; case 2: if ( actorIntegrationProfileOption.integrationProfileOption ) labelSize = [actorIntegrationProfileOption.integrationProfileOption .tfDescription sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap]; break; default: break; } return labelSize.height + 45; } else { return 45 ; } } else return 45 ; } #pragma mark Table view methods - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 3 ; } // Customize the number of rows in the table view. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 3 ; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if ( section == 0 ) { return @"Integration profile" ; } else if ( section == 1 ) { return @"Actor" ; } else { return @"Integration profile option" ; } } // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease]; } if ( actorIntegrationProfileOption != nil ) { NSLog(@"Section %d,row %d",indexPath.section,indexPath.row) ; if ( indexPath.section == 0 ) { switch (indexPath.row) { case 0: cell.textLabel.text = @"Keyword"; NSLog(@"keyword %@", actorIntegrationProfileOption.actorIntegrationProfile.integrationProfile.keyword ) ; cell.detailTextLabel.text = actorIntegrationProfileOption.actorIntegrationProfile.integrationProfile.keyword; break; case 1: cell.textLabel.text = @"Name"; cell.detailTextLabel.text = actorIntegrationProfileOption.actorIntegrationProfile.integrationProfile.name ; break; case 2: cell.textLabel.text = @"Description" ; cell.textLabel.textAlignment = UITextAlignmentLeft ; cell.detailTextLabel.text = actorIntegrationProfileOption.actorIntegrationProfile.integrationProfile.tfDescription ; UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:14.0]; cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap ; cell.detailTextLabel.numberOfLines = 1000 ; cell.detailTextLabel.font = cellFont ; break; } } else if ( indexPath.section == 1 ) { switch (indexPath.row) { case 0: cell.textLabel.text = @"Keyword"; cell.detailTextLabel.text = actorIntegrationProfileOption.actorIntegrationProfile.actor.keyword; break; case 1: cell.textLabel.text = @"Name"; cell.detailTextLabel.text = actorIntegrationProfileOption.actorIntegrationProfile.actor.name ; break; case 2: cell.textLabel.text = @"Description" ; cell.textLabel.textAlignment = UITextAlignmentLeft ; cell.detailTextLabel.text = actorIntegrationProfileOption.actorIntegrationProfile.actor.tfDescription ; UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:14.0]; cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap ; cell.detailTextLabel.numberOfLines = 1000 ; cell.detailTextLabel.font = cellFont ; break; } } else if ( indexPath.section == 2 ) { switch (indexPath.row) { case 0: cell.textLabel.text = @"Keyword"; cell.detailTextLabel.text = actorIntegrationProfileOption.integrationProfileOption.keyword; break; case 1: cell.textLabel.text = @"Name"; cell.detailTextLabel.text = actorIntegrationProfileOption.integrationProfileOption.name ; break; case 2: cell.textLabel.text = @"Description" ; cell.textLabel.textAlignment = UITextAlignmentLeft ; cell.detailTextLabel.text = actorIntegrationProfileOption.integrationProfileOption.tfDescription ; UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:14.0]; cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap ; cell.detailTextLabel.numberOfLines = 1000 ; cell.detailTextLabel.font = cellFont ; break; } } } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Navigation logic may go here. Create and push another view controller. // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; // [self.navigationController pushViewController:anotherViewController]; // [anotherViewController release]; } /* // Override to support conditional editing of the table view. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return YES; } */ /* // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view } } */ /* // Override to support rearranging the table view. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } */ /* // Override to support conditional rearranging of the table view. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } */ - (void)dealloc { [super dealloc]; } @end