I have a problem with a UISwitch in a tableview cell.
This switch is normally in On position, then when a variable changes its value the switch go to the Off position but I have a problem like the switch in the second row:
This is the simple code into the cellForRowAtIndexPath section:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
tableView.backgroundColor = [UIColor clearColor];
tableView.opaque = NO;
tableView.backgroundView = nil;
[tableView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:#"myImage.png"]]];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if ([self.title isEqualToString:#"Test"]) {cell.textLabel.text = [self.tester objectAtIndex: [indexPath row]];cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.accessoryType = UITableViewCellAccessoryNone;
if (([indexPath row] == 5) || ([indexPath row] == 4)){
NSArray *segmentItems = [NSArray arrayWithObjects:#"Down", #"Up", nil];
UISegmentedControl *testSegmentedControl = [[UISegmentedControl alloc] initWithItems:segmentItems];
testSegmentedControl.autoresizingMask = UIViewAutoresizingFlexibleWidth;
testSegmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
testSegmentedControl.tintColor = [UIColor grayColor];
testSegmentedControl.frame = CGRectMake(160, 10, 150, 30);
[testSegmentedControl setTag:[indexPath row]];
[[cell contentView] addSubview:testSegmentedControl];
[testSegmentedControl addTarget:self
action:#selector(testing:)
forControlEvents:UIControlEventValueChanged];
}
else {
mySwitch = [ [ UISwitch alloc ] initWithFrame: CGRectMake(200, 10, 0, 0) ];
mySwitch.tag = [indexPath row];
mySwitch.onTintColor = [UIColor grayColor];
if ([indexPath row] == 0){
if ([asd41 isEqualToString:#"False"]) mySwitch.on = NO;
else mySwitch.on = YES;
}
if ([indexPath row] == 1){
if ([asd40 isEqualToString:#"False"]) mySwitch.on = NO;
else mySwitch.on = YES;
}
if ([indexPath row] == 2){
if ([asd42 isEqualToString:#"False"]) mySwitch.on = NO;
else mySwitch.on = YES;
}
if ([indexPath row] == 3){
if ([asd76 isEqualToString:#"False"]) mySwitch.on = NO;
else mySwitch.on = YES;
}
[ cell addSubview: mySwitch ];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration: 0.2];
[mySwitch addTarget:self action:#selector(switch1:) forControlEvents:UIControlEventValueChanged];}
}
Related
I am having some odd behavior in a side menu. Here is what it should look like:
After I click the button to the right of Organization I use this code to show some more cells
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
If I navigate from the menu with the organization cells showing and then navigate back to the menu it shows this:
The cells show as hidden, but when I set the cells to not hidden like this:
cell.hidden = NO;
it still shows as hidden.
Any ideas as to what is going on? There is nowhere in my code that I set any cells as hidden.
If there is more code you need, then let me know.
Thanks
Here is some more code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = #"MenuCell";
MenuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
cell = [[MenuTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
if (indexPath.section == 0)
{
if (showOrgs && indexPath.row < organizations.count)
{
cell.label.text = [organizations objectAtIndex:indexPath.row];
cell.label.textColor = [UIColor whiteColor];
cell.leftImageView.hidden = YES;
cell.contentView.backgroundColor = [UIColor colorWithHex:#"#ff6b01" alpha:1.0];
cell.tag = 10002;
cell.leftButton.hidden = YES;
cell.righttButton.hidden = YES;
cell.leftButton.enabled = NO;
cell.righttButton.enabled = NO;
}
else if (showOrgs && indexPath.row >= organizations.count)
{
if (indexPath.row == organizations.count)
{
cell.label.text = [allUpper objectAtIndex:indexPath.row];//[organizations objectAtIndex:indexPath.row];
cell.contentView.backgroundColor = [UIColor whiteColor];
cell.label.textColor = [UIColor blackColor];
cell.tag = 10001;
[cell.leftImageView setImage:[UIImage imageNamed:#"dashboard"]];
cell.leftImageView.hidden = NO;
}
else
{
cell.label.text = [allUpper objectAtIndex:indexPath.row];
cell.label.textColor = [UIColor blackColor];
cell.contentView.backgroundColor = [UIColor whiteColor];
cell.tag = 10003;
if ([[allUpper objectAtIndex:indexPath.row] isEqualToString:#"All Media"])
{
cell.leftImageView.image = [UIImage imageNamed:#"image-btn"];
cell.leftImageView.hidden = NO;
}
}
}
NSLog(#"Row: %li", (long)indexPath.row);
if (!showOrgs && [[upperSection objectAtIndex:indexPath.row] isEqualToString:#"Dashboard"])
{
cell.label.text = [upperSection objectAtIndex:indexPath.row];//[organizations objectAtIndex:indexPath.row];
cell.contentView.backgroundColor = [UIColor whiteColor];
cell.tag = 10001;
cell.hidden = NO;
[cell.leftImageView setImage:[UIImage imageNamed:#"dashboard"]];
}
else if (!showOrgs && [[upperSection objectAtIndex:indexPath.row] isEqualToString:#"All Media"])
{
cell.label.text = [upperSection objectAtIndex:indexPath.row];
cell.contentView.backgroundColor = [UIColor whiteColor];
cell.tag = 10003;
cell.hidden = NO;
if ([[upperSection objectAtIndex:indexPath.row] isEqualToString:#"All Media"])
{
cell.leftImageView.image = [UIImage imageNamed:#"image-btn"];
}
}
}
// if (indexPath.section == 0 && showOrgs)
// cell.label.text = [organizations objectAtIndex:indexPath.row];
else if (indexPath.section == 1)
cell.label.text = [currentEvents objectAtIndex:indexPath.row];
else
cell.label.text = [allEvents objectAtIndex:indexPath.row];
return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0 && !showOrgs)
return upperSection.count;
else if (section == 0 && showOrgs)
return allUpper.count;
else if (section == 1)
return currentEvents.count;
else
return allEvents.count;
}
I made some changes to the blocks following the suggestion of wottle and then added this to the end of the block for when not showing orgs
cell.leftButton.hidden = NO;
cell.righttButton.hidden = NO;
cell.leftButton.enabled = YES;
cell.righttButton.enabled = YES;
cell.leftImageView.hidden = NO;
cell.label.hidden = NO;
cell.label.textColor = [UIColor blackColor];
That seems to have solved it. Thanks for all your help.
I am trying to make quiz program. I used to UITableview for answers. How can i make to flashing on background when user click the correct answer? Is it possible?
Here is the some part of my project;
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]];
//cell=[[UITableViewCell alloc] initWithStyle:UITableViewStylePlain reuseIdentifier:#"Cell"];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:#"Cell"];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
}
NSNumber *rowNsNum = [NSNumber numberWithUnsignedInt:indexPath.row];
if ( [selectedCells containsObject:rowNsNum] )
{
//cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
NSString *text = [answers objectAtIndex:indexPath.row];
NSData *data = [text dataUsingEncoding: [NSString defaultCStringEncoding] ];
cell.textLabel.text = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding ];
//cell.textLabel.text=[answers objectAtIndex:indexPath.row];
cell.textLabel.backgroundColor = [UIColor clearColor];
tableView.backgroundColor=[UIColor whiteColor];
cell.backgroundColor=[UIColor whiteColor];
[cell.textLabel setFont:[UIFont fontWithName:#"Helvatica" size:15]];
return cell;
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
CGRect rect = cell.frame;
UIView * view = [[UIView alloc] init];
UIImageView *back = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"ListGray"] ];
BOOL selx;
if (answerType==2)
selx = [self isSelected:indexPath];
else
selx = [lastIndexPath isEqual:indexPath];
if (selx) {
back = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"aaaa.png"] ];
cell.textLabel.textColor = [UIColor whiteColor];
[view addSubview:back];
cell.backgroundView = view;
back.frame = CGRectMake(0, 12,rect.size.width,rect.size.height-12);
} else {
cell.accessoryView = nil;
if (lastIndexPath != nil){
cell.textLabel.textColor = [UIColor blackColor];
[view addSubview:back];
cell.backgroundView = view;
back.frame = CGRectMake(0, 12,rect.size.width,rect.size.height-12);
back = nil;
}
}
[view addSubview:back];
cell.backgroundView = view;
back.frame = CGRectMake(0, 12,rect.size.width,rect.size.height-12);
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
tableView.allowsSelection = NO;
[tableView deselectRowAtIndexPath:indexPath animated:YES];
NSNumber *rowNsNum = [NSNumber numberWithUnsignedInt:indexPath.row];
if (answerType==3) {
NSString *secilenAnswerID;
secilenAnswerID= [genelAnswersID valueForKey:[answers objectAtIndex:indexPath.row]];
for (int a=0; a<[answers count]; a++) {
cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:a inSection:0]];
cell. accessoryType= UITableViewCellAccessoryNone;
[selectedCells removeObject:rowNsNum];
selectedCells=[[NSMutableArray alloc]init];
}
cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]];
isRadioSelected=TRUE;
radioAnswer = [genelAnswersID valueForKey:[answers objectAtIndex:indexPath.row]];
[selectedCells addObject:rowNsNum];
lastIndexPath = indexPath;
[tableView reloadData];
}
}
Sorry for my bad english. Thank you for your interest.
You can add a background view into your UITableViewCell with a backgroundColor. Then in your tableView: didSelectRowAtIndexPath: you can animate the hidden or alpha with the animation APIs in UIView. When the animation finishes you can animate hidden to TRUE or alpha back to 0 to get the flash effect.
Here is my question's solution. I took advice from Stephen Johnson:)
[UIView animateWithDuration:0.1f delay:0 options:(UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat) animations:^{
[UIView setAnimationRepeatCount:3];
cell.alpha = 0;
} completion: ^(BOOL finished) {
cell.hidden = YES;
[UIView animateWithDuration:0.1 animations:^{
cell.alpha = 1;
} completion: ^(BOOL finished) {
cell.hidden = NO;
}];
}];
I have defined 3 sections with different numbers of cell on each. It works but when editing the text still there. I tried to clear the content when start typing but didn't work.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
UITextField *fdates = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
fdates.adjustsFontSizeToFitWidth = YES;
UITextField *fdeparture= [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
fdeparture.adjustsFontSizeToFitWidth = YES;
UITextField *farrival = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
farrival.adjustsFontSizeToFitWidth = YES;
UITextField *faircraft = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
faircraft.adjustsFontSizeToFitWidth = YES;
if ([indexPath section] == 0) {
if ([indexPath row] == 0) {
fdates.text = fplan.dates;
fdates.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
fdates.returnKeyType = UIReturnKeyNext;
}
}else if ([indexPath section] == 1) {
if (indexPath.row == 0) {
fdeparture.text = fplan.depAirport;
fdeparture.keyboardType = UIKeyboardTypeDefault;
fdeparture.returnKeyType = UIReturnKeyNext;
}else {
farrival.text = fplan.destAirport;
farrival.keyboardType = UIKeyboardTypeDefault;
farrival.returnKeyType = UIReturnKeyNext;
}
}else {
if (indexPath.row == 0) {
faircraft.text = fplan.aircraft_id;
faircraft.keyboardType = UIKeyboardTypeDefault;
faircraft.returnKeyType = UIReturnKeyNext;
// faircraft.
}
}
[cell.contentView addSubview:fdates];
[cell.contentView addSubview:fdeparture];
[cell.contentView addSubview:farrival];
[cell.contentView addSubview:faircraft];
return cell;
}
To be more clear:
Thanks!!
try following code. i have edited your code use this
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
UITextField *fdates = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)];
fdates.adjustsFontSizeToFitWidth = YES;
if ([indexPath section] == 0) {
if ([indexPath row] == 0) {
fdates.text = fplan.dates;
fdates.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
fdates.returnKeyType = UIReturnKeyNext;
}
}else if ([indexPath section] == 1) {
if (indexPath.row == 0) {
fdates.text = fplan.depAirport;
fdates.keyboardType = UIKeyboardTypeDefault;
fdates.returnKeyType = UIReturnKeyNext;
}else {
fdates.text = fplan.destAirport;
fdates.keyboardType = UIKeyboardTypeDefault;
fdates.returnKeyType = UIReturnKeyNext;
}
}else {
if (indexPath.row == 0) {
fdates.text = fplan.aircraft_id;
fdates.keyboardType = UIKeyboardTypeDefault;
fdates.returnKeyType = UIReturnKeyNext;
// faircraft.
}
}
[cell.contentView addSubview:fdates];
return cell;
}
Try to add on cell not on content view....for more info see below....
[cell addSubview:fdates];
[cell addSubview:fdeparture];
[cell addSubview:farrival];
[cell addSubview:faircraft];
I add in a UiTableViewCell a UITextField *gasPrice; like this:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier;
if (indexPath.section == 0 && indexPath.row < [self.userCarsArray count])
CellIdentifier = [NSString stringWithFormat:#"Cell%d%d%#", indexPath.section, indexPath.row, [[self.userCarsArray objectAtIndex:indexPath.row] idCar]];
else if (indexPath.section == 0 && indexPath.row == [self.userCarsArray count])
CellIdentifier = [NSString stringWithFormat:#"Cell%d%d%#", indexPath.section, indexPath.row, #"AddCar"];
else
CellIdentifier = [NSString stringWithFormat:#"Cell%d%d", indexPath.section, indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
if (indexPath.section == 1 && indexPath.row == 0) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
else if (indexPath.section == 2 && indexPath.row == 2) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
else {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if (indexPath.section == 1 && indexPath.row == 1) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(170, 10, 125, 30)];
textField.adjustsFontSizeToFitWidth = YES;
textField.textColor = [UIColor colorWithRed:0.20f green:0.30f blue:0.49f alpha:1.0f];
textField.placeholder = #"0.00";
textField.keyboardType = UIKeyboardTypeDecimalPad;
textField.returnKeyType = UIReturnKeyDone;
textField.backgroundColor = [UIColor whiteColor];
textField.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support
textField.autocapitalizationType = UITextAutocapitalizationTypeNone; // no auto capitalization support
textField.textAlignment = UITextAlignmentRight;
textField.tag = 0;
textField.delegate = self;
textField.clearButtonMode = UITextFieldViewModeNever; // no clear 'x' button to the right
[textField setEnabled: YES];
[cell addSubview:textField];
[textField release];
gasField = textField;
}
}
// Selection style.
cell.selectionStyle = UITableViewCellSelectionStyleGray;
// Vehicles cells.
if (indexPath.section == 0) {
// ...
}
// General cells.
if (indexPath.section == 1) {
if (indexPath.row == 0) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.text = #"Measurement System";
cell.textLabel.textColor = [UIColor darkGrayColor];
if ([EcoAppAppDelegate measurement] == MeasurementTypeMile)
cell.detailTextLabel.text = #"Miles";
else
cell.detailTextLabel.text = #"Meters";
}
if (indexPath.row == 1) {
cell.textLabel.textColor = [UIColor darkGrayColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if ([EcoAppAppDelegate measurement] == MeasurementTypeMile)
cell.textLabel.text = #"Gas Price (gal)";
else
cell.textLabel.text = #"Gas Price (L)";
// Gas price.
if ([EcoAppAppDelegate gasPrice] != 0.00)
gasField.text = [NSString stringWithFormat:#"%.2f", [EcoAppAppDelegate gasPrice]];
}
}
// Information cells.
if (indexPath.section == 2) {
// ...
}
return cell;
}
Then, to manage the keyboard when the user is done (because I use a keyboard without return key), I have those functions:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
UIBarButtonItem *doneButton = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:#selector(done:)] autorelease];
[self.navigationItem setLeftBarButtonItem:doneButton animated:YES];
return YES;
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
// Save gas price.
if ([textField.text isEqualToString:#""])
[EcoAppAppDelegate setGasPrice:0.00];
else
[EcoAppAppDelegate setGasPrice:[textField.text floatValue]];
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
// Hide keyboard.
[textField resignFirstResponder];
return YES;
}
And the function for the navigation bar button "Done":
- (void)done:(id)sender {
if ([gasField canResignFirstResponder]) {
[gasField resignFirstResponder];
}
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
}
So it works fine first, when I stay in my settings view controller, but when I do other stuff on some other cells (that push other view controllers, come back, etc), it stops working. It is probably because the gasField pointer has disappeared or something like that, the gasField object tho is still different from nil.
Any idea why it does that? Thanks!
I think you are using gasField as a property. use
self.gasField
My table only has 2 sections. I have a UITextView as a subview in the 2nd section of my table. and a list of possible quotes in the first section.
I'm having a problem where once the user selects a particular quote which gets "pasted" into the UITextView like so:
replyTextView.text = [NSString stringWithFormat:#"#%# UserName writes... \n[\"%#\"]", replyPostCode,[separatedString objectAtIndex:indexPath.row]];
or types text into the textview, after they scroll away from the textview so it's off the screen it gets cleared. I guess this is because I keep releasing it from my table..
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
NSString *replyCellIdentifier = #"replyCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
if ([indexPath section] == 0) {
cell = [self CreateMultilinesCell:CellIdentifier];
}
else if ([indexPath section] == 1) {
//NSLog(#"TextField");
cell = [self CreateMultilinesCell:replyCellIdentifier];
if ([indexPath row] == 0) {
replyTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 300, 150)];
//replyTextView.adjustsFontSizeToFitWidth = YES;
replyTextView.textColor = [UIColor blackColor];
replyTextView.keyboardType = UIKeyboardTypeASCIICapable;
replyTextView.returnKeyType = UIReturnKeyDefault;
replyTextView.backgroundColor = [UIColor whiteColor];
replyTextView.autocorrectionType = UITextAutocorrectionTypeNo;
replyTextView.autocapitalizationType = UITextAutocapitalizationTypeNone;
replyTextView.textAlignment = UITextAlignmentLeft;
replyTextView.tag = 0;
replyTextView.editable = YES;
replyTextView.delegate = self;
replyTextView.scrollEnabled = YES;
//[replyTextView becomeFirstResponder];
//replyTextView.clearButtonMode = UITextFieldViewModeNever;
//[replyTextView setEnabled: YES];
[cell.contentView addSubview:replyTextView];
[replyTextView release];
//cell.detailTextLabel.text = #"";
}
}
}
//NSLog(#"%d", [indexPath section]);
if ([indexPath section] == 0) {
cell.detailTextLabel.text = [separatedString objectAtIndex:indexPath.row];
}
return cell;
}
I'm just wondering just what is the best way to keep the text in my UITextView when the user scrolls the uitextview off the screen and back again?
update
- (UITableViewCell*) CreateMultilinesCell :(NSString*)cellIdentifier
{
//NSLog(#"Entering CreateMultilinesCell");
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:cellIdentifier] autorelease];
cell.detailTextLabel.numberOfLines = 0;
cell.detailTextLabel.font = [self SubFont];
cell.detailTextLabel.textColor = [UIColor colorWithRed:10.0/255 green:10.0/255 blue:33.0/255 alpha:1.0];
[cell setBackgroundColor:[UIColor clearColor]];//]colorWithRed:.98 green:.98 blue:.99 alpha:1.0]];
[self.tableView setBackgroundColor:[UIColor clearColor]];//colorWithRed:.94 green:.96 blue:.99 alpha:1.0]];
//NSLog(#"Exiting CreateMultilinesCell");
return cell;
}
The easiest solution is to use a different cell identifier for the two types of cells.
Edit: I see you are using two different types, but you are not taking that into account in the dequeue call.