how to hide/show pickerview by click on textfield - iphone
-(void)textFieldDidBeginEditing:(UITextField *)myTextField{
[myTextField resignFirstResponder];
UITextField *tempbtn;
tempbtn = myTextField;
btntagvalue = tempbtn.tag;
if(btntagvalue == 1)
{
if ((quantitypicker.hidden == NO) || (frequencyvalues.hidden == NO) ||(daysnum.hidden ==
NO)) {
[quantitypicker setHidden:YES];
[frequencyvalues setHidden:YES];
[daysnum setHidden:YES];
}
if ((quantitypicker.hidden == NO)||(frequencyvalues.hidden==NO)||(daysnum.hidden==YES))
{
[quantitypicker setHidden:YES];
[frequencyvalues setHidden:YES];
}
if ((quantitypicker.hidden==YES)||(frequencyvalues.hidden==NO)||(daysnum.hidden==NO))
{
[frequencyvalues setHidden:YES];
[daysnum setHidden:YES];
}
if ((quantitypicker.hidden==NO)||(frequencyvalues.hidden==YES)||(daysnum.hidden==NO))
{
[quantitypicker setHidden:YES];
[daysnum setHidden:YES];
}
datevalues = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 150, 320, 280)];
datevalues.datePickerMode = UIDatePickerModeDateAndTime;
datevalues.minimumDate=[NSDate date];
[self.view addSubview:datevalues];
[datevalues addTarget:self
action:#selector(datepicker:)forControlEvents:UIControlEventValueChanged];
[datevalues release];
}
if (btntagvalue == 2) {
if ((datevalues.hidden == NO) || (frequencyvalues.hidden == NO) ||(daysnum.hidden == NO)) {
[datevalues setHidden:YES];
[frequencyvalues setHidden:YES];
[daysnum setHidden:YES];
}
if ((datevalues.hidden == NO) || (frequencyvalues.hidden == NO) ||(daysnum.hidden == YES)) {
[datevalues setHidden:YES];
[frequencyvalues setHidden:YES];
}
if ((datevalues.hidden == YES) || (frequencyvalues.hidden == NO) ||(daysnum.hidden == NO)) {
[frequencyvalues setHidden:YES];
[daysnum setHidden:YES];
}
if ((datevalues.hidden == NO) || (frequencyvalues.hidden == YES) ||(daysnum.hidden == NO)) {
[datevalues setHidden:YES];
[daysnum setHidden:YES];
}
quantitypicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0,190,320,220)];
if ([meditype isEqualToString:#"Capsules"]) {
quantitytype = [[NSMutableArray
alloc]initWithObjects:#"1",#"2",#"3",#"4",#"5",#"6",#"7",#"8",#"9",#"10",nil];
}
if ([meditype isEqualToString:#"Eyedrops"]||[meditype isEqualToString:#"Eardrops"]||\
[meditype isEqualToString:#"Nosedrops"]) {
quantitytype = [[NSMutableArray
alloc]initWithObjects:#"1",#"2",#"3",#"4",#"5",#"6",#"7",#"8",#"9",#"10",nil];
}
if ([meditype isEqualToString:#"Inhaler"]) {
quantitytype = [[NSMutableArray alloc]initWithObjects:#"1 dose",#"2 doses",#"3
doses",#"4 doses",#"5 doses",#"6 doses",#"7 doses",#"8 doses",#"9 doses",#"10 doses",nil];
}
if ([meditype isEqualToString:#"Syrup"]) {
quantitytype = [[NSMutableArray alloc]initWithObjects:#"1 tablespoon",#"2
tablespoon",#"3 tablespoon",#"4 tablespoon",#"5 tablespoon",#"6 tablespoon",#"7
tablespoon",#"8 tablespoon",#"9 tablespoon",#"10 tablespoon",nil];
}
if ([meditype isEqualToString:#"Oils"]) {
quantitytype = [[NSMutableArray alloc]initWithObjects:#"1 ml",#"2 ml",#"3 ml",#"4
ml",#"5 ml",#"6 ml",#"7 ml",#"8 ml",#"9 ml",#"10 ml",nil];
}
if ([meditype isEqualToString:#"Injections"]) {
quantitytype = [[NSMutableArray
alloc]initWithObjects:#"1",#"2",#"3",#"4",#"5",#"6",#"7",#"8",#"9",#"10",nil];
}
quantitypicker.delegate = self;
quantitypicker.showsSelectionIndicator = YES;
quantitypicker.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:quantitypicker];
}
if (btntagvalue ==3) {
if ((datevalues.hidden == NO) || (quantitypicker.hidden == NO) ||(daysnum.hidden == NO)) {
[datevalues setHidden:YES];
[quantitypicker setHidden:YES];
[daysnum setHidden:YES];
}
if ((datevalues.hidden == NO) || (quantitypicker.hidden == NO) ||(daysnum.hidden == YES)) {
[datevalues setHidden:YES];
[quantitypicker setHidden:YES];
}
if ((datevalues.hidden == YES) || (quantitypicker.hidden == NO) ||(daysnum.hidden == NO)) {
[quantitypicker setHidden:YES];
[daysnum setHidden:YES];
}
if ((datevalues.hidden == NO) || (quantitypicker.hidden == YES) ||(daysnum.hidden == NO)) {
[datevalues setHidden:YES];
[daysnum setHidden:YES];
}
frequencyvalues = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 190, 320, 220)];
arrayfreq = [[NSMutableArray alloc]initWithObjects:#"1",#"2",#"3",#"4",#"5",
#"6",#"7",#"8",#"9",#"10",#"11",#"12",#"13",#"14",#"15",#"16",
#"17",#"18",#"19",#"20",#"21",#"22",#"23",#"24", nil];
frequencyvalues.delegate = self;
frequencyvalues.showsSelectionIndicator = YES;
frequencyvalues.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:frequencyvalues];
}
if (btntagvalue ==4) {
if ((datevalues.hidden == NO) || (frequencyvalues.hidden == NO) ||(quantitypicker.hidden ==
NO)) {
[datevalues setHidden:YES];
[frequencyvalues setHidden:YES];
[quantitypicker setHidden:YES];
}
if ((datevalues.hidden == NO) || (frequencyvalues.hidden == NO) ||(quantitypicker.hidden ==
YES)) {
[datevalues setHidden:YES];
[frequencyvalues setHidden:YES];
}
if ((datevalues.hidden == YES) || (frequencyvalues.hidden == NO) ||(quantitypicker.hidden ==
NO)) {
[frequencyvalues setHidden:YES];
[quantitypicker setHidden:YES];
}
if ((datevalues.hidden == NO) || (frequencyvalues.hidden == YES) ||(quantitypicker.hidden ==
NO)) {
[datevalues setHidden:YES];
[quantitypicker setHidden:YES];
}
daysnum = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 190, 320, 220)];
arraytime = [[NSMutableArray alloc]initWithObjects:#"1",#"2",#"3",#"4",#"5",
#"6",#"7",#"8",#"9",#"10",#"11",#"12",#"13",#"14",#"15",#"16",
#"17",#"18",#"19",#"20",#"21",#"22",#"23",#"24",#"25",#"26",#"27",#"28",#"29",#"30",#"31",
nil];
daysnum.delegate = self;
daysnum.showsSelectionIndicator = YES;
daysnum.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:daysnum];
}
}
thanks to all for viewing my problem. I have solved it by using conditions in each if loop.. i have edited the above code
Related
i have issue with prototype table view cell that my cell text is overlapping every time when it get used
This is my code every time when i scroll my labels text are getting overleaped.Text are overlapping and i think this is because reuse of cell. I am using storyboard and this is not a custom cell. Need some help,every single help would be appreciated. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *TableViewCEll =#"TableViewCell"; UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:TableViewCEll forIndexPath:indexPath]; if (Cell == nil) { Cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableViewCEll]; } UIImageView *imageView=[[UIImageView alloc]init]; imageView.frame =CGRectMake(5, 5, 100,110); [Cell.contentView addSubview:imageView]; NSArray * array =[[self.ListOfCarArray objectAtIndex:indexPath.row]objectForKey:#"CarImage"]; if (array.count >0) { NSString * str = [NSString stringWithFormat:#"%#uploads/Car/%#",[self.GetUserConfiDict objectForKey:#"server"],[[array objectAtIndex:0]objectForKey:#"name"]]; AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc]init]; manager.responseSerializer = [AFImageResponseSerializer serializer]; [manager GET:str parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { imageView.image = responseObject; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(#"Failed with error %#.",[error localizedFailureReason]); }]; } UILabel * ModelLbl =[[UILabel alloc]initWithFrame:CGRectMake(120, 10, 120, 25)]; ModelLbl.textColor = [UIColor whiteColor]; NSDictionary *str = [[NSDictionary alloc]init]; str =[[self.ListOfCarArray objectAtIndex:indexPath.row]objectForKey:#"Car"]; ModelLbl.text = [str objectForKey:#"model"]; [Cell.contentView addSubview:ModelLbl]; int x = 120; int y = 50; for (int i = 1; i<=5; i++) { UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(x, y, 84,15)]; label.textColor = [UIColor whiteColor]; if (i ==1) { id null = [str objectForKey:#"year"]; if ([null isKindOfClass:[NSNull class]]) { label.text =#""; } else{ label.text = [str objectForKey:#"year"]; [Cell.contentView addSubview:label]; } } else if (i == 2){ id null = [str objectForKey:#"color"]; if ([null isKindOfClass:[NSNull class]]) { label.text =#""; } else{ label.text =[str objectForKey:#"color"]; [Cell.contentView addSubview:label]; } } else if (i == 3){ id null = [str objectForKey:#"price"]; if ([null isKindOfClass:[NSNull class]]) { label.text =#""; } else{ label.text =[str objectForKey:#"price"]; [Cell.contentView addSubview:label]; x+=100; y = 30; } } else if (i ==4) { id null = [str objectForKey:#"miles"]; if ([null isKindOfClass:[NSNull class]]) { label.text =#""; } else{ label.text =[str objectForKey:#"miles"]; [Cell.contentView addSubview:label]; } } else if (i == 5){ id null = [str objectForKey:#"stock_number"]; if ([null isKindOfClass:[NSNull class]]) { label.text =#""; } else{ label.text =[str objectForKey:#"stock_number"]; [Cell.contentView addSubview:label]; } } y+=20; } return Cell; }
i got my answer and this is what i was searching for.. for (UILabel *lbl in cell.contentView.subviews) { if ([lbl isKindOfClass:[UILabel class]]) { [lbl removeFromSuperview]; } }
Yes, this is caused by the reuse of the table view cell. It is not only the labels but also the imageView. You are adding the imageView with this method [Cell.contentView addSubview:imageView]; every time, while it should only be done when the cell is created, i.e. inside the if (Cell == nil) { Cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableViewCEll]; } I'd advise to use a custom UITableViewCell subclass, but if you stick with the current approach, I'd do it this way: static int IMAGE_VIEW_TAG = 1; if (Cell == nil) { Cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableViewCEll]; UIImageView *imageView = [[UIImageView alloc]init]; imageView.frame = CGRectMake(5, 5, 100,110); imageView.tag = IMAGE_VIEW_TAG; [Cell.contentView addSubview:imageView]; } Further below, you can refer to the imageView by the tag: ((UIImageView *)[Cell.contentView viewWithTag:IMAGE_VIEW_TAG]).image = responseObject; You'll have to do the same for the labels.
Custom cell take time to load in tableview?
Hello Friends I am asking about to table view, when I use table view delegate i am not using cell dequeue resuable properly in the cellForRowAtIndexpath function , noOfRowInTAble And heightForRowAtIndexPath call property but take time to call ccellForRowAtIndexpath function , so i also add the code of cellForRowAtIndexpath function -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath )indexPath { DialogCustomCell *cell = nil; if (_fieldDetailArray && [_fieldDetailArray count] > 0) { if (indexPath.row < [_fieldDetailArray count]) { FieldDetail *fieldObject = (FieldDetail *)[_fieldDetailArray objectAtIndex:indexPath.row]; NSInteger nibItemNo = [fieldObject.fieldType integerValue]; NSString *fieldOrientation = fieldObject.fieldOrientation; NSString *fieldIsRequired = fieldObject.fieldIsRequired; NSString *fieldName = fieldObject.fieldName; if (!cell) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"DialogCustomCell" owner:self options:nil]; cell = (DialogCustomCell *)[nib objectAtIndex:nibItemNo]; cell.delegate = self; cell.fieldId = fieldObject.fieldId; } switch (nibItemNo) { case EDIT_TEXT: { if (![fieldOrientation integerValue]) { [cell.editFrontView setHidden:NO]; [cell.editBelowView setHidden:YES]; cell.editFrontTextView.delegate = self; if (![fieldIsRequired integerValue]) { cell.editFrontLabel.text = [fieldName stringByAppendingString:#"*"]; cell.editFrontTextView.placeholder = [fieldName stringByAppendingString:#"*"]; cell.editFrontTextView.text = [_formDataDic valueForKey:cell.fieldId]; } else { cell.editFrontLabel.text = fieldName; cell.editFrontTextView.placeholder = fieldName; cell.editFrontTextView.text = [_formDataDic valueForKey:cell.fieldId]; } [_fieldIdDic setObject:cell.fieldId forKey:cell.editFrontLabel.text]; [_textFieldkeyArray addObject:cell.editFrontTextView]; } else { [cell.editFrontView setHidden:YES]; [cell.editBelowView setHidden:NO]; cell.editBelowTextField.delegate = self; if (![fieldIsRequired integerValue]) { cell.editBelowLabel.text = [fieldName stringByAppendingString:#"*"]; cell.editBelowTextField.placeholder = [fieldName stringByAppendingString:#"*"]; cell.editBelowTextField.text = [_formDataDic valueForKey:cell.fieldId]; } else { cell.editBelowLabel.text = fieldName; cell.editBelowTextField.placeholder = fieldName; cell.editBelowTextField.text = [_formDataDic valueForKey:cell.fieldId]; } [_fieldIdDic setObject:cell.fieldId forKey:cell.editBelowLabel.text]; [_textFieldkeyArray addObject:cell.editBelowTextField]; } } break; case NUMBER : { if (![fieldOrientation integerValue]) { [cell.numberFrontView setHidden:NO]; [cell.numberBelowView setHidden:YES]; cell.numberFrontTextView.delegate = self; if (![fieldIsRequired integerValue]) { cell.numberFrontLabel.text = [fieldName stringByAppendingString:#"*"]; cell.numberFrontTextView.placeholder = [fieldName stringByAppendingString:#"*"]; cell.numberFrontTextView.text = [_formDataDic valueForKey:cell.fieldId]; } else { cell.numberFrontLabel.text = fieldName; cell.numberFrontTextView.placeholder =fieldName; cell.numberFrontTextView.text = [_formDataDic valueForKey:cell.fieldId]; } [_fieldIdDic setObject:cell.fieldId forKey:cell.numberFrontLabel.text]; [_textFieldkeyArray addObject:cell.numberFrontTextView]; }else { [cell.numberFrontView setHidden:YES]; [cell.numberBelowView setHidden:NO]; cell.numberBelowTextField.delegate = self; if (![fieldIsRequired integerValue]) { cell.numberBelowLabel.text = [fieldName stringByAppendingString:#"*"]; cell.numberBelowTextField.placeholder = [fieldName stringByAppendingString:#"*"]; cell.numberBelowTextField.text = [_formDataDic valueForKey:cell.fieldId]; } else { cell.numberBelowLabel.text = fieldName; cell.numberBelowTextField.placeholder = fieldName; cell.numberBelowTextField.text = [_formDataDic valueForKey:cell.fieldId]; } [_fieldIdDic setObject:cell.fieldId forKey:cell.numberBelowLabel.text]; [_textFieldkeyArray addObject:cell.numberBelowTextField]; } } break; case DECIMAL: { if (![fieldOrientation integerValue]) { [cell.decimalFrontView setHidden:NO]; [cell.decimalBelowView setHidden:YES]; cell.decimalFrontTextView.delegate = self; if (![fieldIsRequired integerValue]) { cell.decimalFrontLabel.text = [fieldName stringByAppendingString:#"*"]; cell.decimalFrontTextView.placeholder = [fieldName stringByAppendingString:#"*"]; cell.decimalFrontTextView.text = [_formDataDic valueForKey:cell.fieldId]; } else { cell.decimalFrontLabel.text = fieldName; cell.decimalFrontTextView.placeholder = fieldName; cell.decimalFrontTextView.text = [_formDataDic valueForKey:cell.decimalFrontTextView.placeholder]; } [_fieldIdDic setObject:cell.fieldId forKey:cell.decimalFrontLabel.text]; [_textFieldkeyArray addObject:cell.decimalFrontTextView]; }else { [cell.decimalFrontView setHidden:YES]; [cell.decimalBelowView setHidden:NO]; cell.decimalBelowTextField.delegate = self; if (![fieldIsRequired integerValue]) { cell.decimalBelowLabel.text = [fieldName stringByAppendingString:#"*"] ; cell.decimalBelowTextField.placeholder = [fieldName stringByAppendingString:#"*"]; cell.decimalBelowTextField.text = [_formDataDic valueForKey:cell.fieldId]; } else { cell.decimalBelowLabel.text = fieldName; cell.decimalBelowTextField.placeholder = fieldName; cell.decimalBelowTextField.text = [_formDataDic valueForKey:cell.fieldId]; } [_fieldIdDic setObject:cell.fieldId forKey:cell.decimalBelowLabel.text]; [_textFieldkeyArray addObject:cell.decimalBelowTextField]; } } break; case LIST: { [_fieldIdDic setObject:cell.fieldId forKey:cell.listLabel.text]; cell.comboCellList = [[NSArray alloc]initWithArray:fieldObject.fieldComboData]; if ([fieldOrientation integerValue]) { if (![fieldIsRequired integerValue]) { cell.listLabel.text = [fieldName stringByAppendingString:#"*"]; if ([_formDataDic valueForKey:cell.fieldId]) { [cell.listButton setTitle:[_formDataDic valueForKey:cell.fieldId] forState:UIControlStateNormal]; }else { [cell.listButton setTitle:[fieldObject.fieldComboData objectAtIndex:0] forState:UIControlStateNormal]; } } else { cell.listLabel.text = fieldName; if ([_formDataDic valueForKey:cell.fieldId]) { [cell.listButton setTitle:[_formDataDic valueForKey:cell.fieldId] forState:UIControlStateNormal]; }else { [cell.listButton setTitle:[fieldObject.fieldComboData objectAtIndex:0] forState:UIControlStateNormal]; } } } } break; case DATETIME: { if ([fieldOrientation integerValue]) { if (![fieldIsRequired integerValue]) { cell.dateTimeLabel.text = [fieldName stringByAppendingString:#"*"]; if ([_formDataDic valueForKey:cell.fieldId]) { [cell.datePicker setDate:[Date convertDateFromString:[_formDataDic valueForKey:cell.fieldId] withDateFormat:DATE_FORMATE]]; } } else { cell.dateTimeLabel.text = fieldName; if ([_formDataDic valueForKey:cell.fieldId]) { [cell.datePicker setDate:[Date convertDateFromString:[_formDataDic valueForKey:cell.fieldId] withDateFormat:DATE_FORMATE]]; } } [_fieldIdDic setObject:cell.fieldId forKey:cell.dateTimeLabel.text]; } } break; case SIGNATURE_TYPE: { if (![fieldOrientation integerValue]) { [cell.signatureFrontView setHidden:NO]; [cell.signatureBelowView setHidden:YES]; if (![fieldIsRequired integerValue]) { cell.signatureFrontLabel.text = [fieldName stringByAppendingString:#"*"]; } else { cell.signatureFrontLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.signatureFrontLabel.text]; }else { [cell.signatureFrontView setHidden:YES]; [cell.signatureBelowView setHidden:NO]; if (![fieldIsRequired integerValue]) { cell.signatureBelowLabel.text = [fieldName stringByAppendingString:#"*"] ; } else { cell.signatureBelowLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.signatureBelowLabel.text]; } } break; case ATTACHMENT: { if (![fieldOrientation integerValue]) { [cell.attachmentFrontView setHidden:NO]; [cell.attachmentBelowView setHidden:YES]; if (![fieldIsRequired integerValue]) { cell.attachmentFrontLabel.text = [fieldName stringByAppendingString:#"*"]; } else { cell.attachmentFrontLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.attachmentFrontLabel.text]; }else { [cell.attachmentFrontView setHidden:YES]; [cell.attachmentBelowView setHidden:NO]; if (![fieldIsRequired integerValue]) { cell.attachmentBelowLabel.text = [fieldName stringByAppendingString:#"*"] ; } else { cell.attachmentBelowLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.attachmentBelowLabel.text]; } } break; case CHECKBOK: { if ([fieldOrientation integerValue]) { if (![fieldIsRequired integerValue]) { cell.checkBoxLabel.text = [fieldName stringByAppendingString:#"*"]; if ([_formDataDic valueForKey:cell.fieldId]) { [cell.checkBoxBtn setTitle:[_formDataDic valueForKey:cell.fieldId] forState:UIControlStateNormal]; }else { [cell.checkBoxBtn setTitle:[fieldObject.fieldComboData objectAtIndex:0] forState:UIControlStateNormal]; } } else { cell.checkBoxLabel.text = fieldName; if ([_formDataDic valueForKey:cell.fieldId]) { [cell.checkBoxBtn setTitle:[_formDataDic valueForKey:cell.fieldId] forState:UIControlStateNormal]; }else { [cell.checkBoxBtn setTitle:[fieldObject.fieldComboData objectAtIndex:0] forState:UIControlStateNormal]; } } cell.comboCellList = [[NSArray alloc]initWithArray:fieldObject.fieldComboData]; [_fieldIdDic setObject:cell.fieldId forKey:cell.checkBoxLabel.text]; } } break; case QRCODE: { if (![fieldOrientation integerValue]) { [cell.qrCodeFrontView setHidden:NO]; [cell.qrCodeBelowView setHidden:YES]; if (![fieldIsRequired integerValue]) { cell.qrFrontCodeLabel.text = [fieldName stringByAppendingString:#"*"]; } else { cell.qrFrontCodeLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.qrFrontCodeLabel.text]; }else { [cell.qrCodeFrontView setHidden:YES]; [cell.qrCodeBelowView setHidden:NO]; if (![fieldIsRequired integerValue]) { cell.qrBelowCodeLabel.text = [fieldName stringByAppendingString:#"*"] ; } else { cell.qrBelowCodeLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.qrBelowCodeLabel.text]; } if ([[_formDataDic allKeys] containsObject:cell.fieldId]) { [cell.qrCodeBelowBtn setTitle:NSLocalizedString(#"Change QR Code", Nil) forState:UIControlStateNormal]; [cell.qrCodeFrontBtn setTitle:NSLocalizedString(#"Change QR Code", Nil) forState:UIControlStateNormal]; } } break; case BARCODE: { if (![fieldOrientation integerValue]) { [cell.barCodeFrontView setHidden:NO]; [cell.barCodeBelowView setHidden:YES]; if (![fieldIsRequired integerValue]) { cell.barFrontCodeLabel.text = [fieldName stringByAppendingString:#"*"]; } else { cell.barFrontCodeLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.barFrontCodeLabel.text]; }else { [cell.barCodeFrontView setHidden:YES]; [cell.barCodeBelowView setHidden:NO]; if (![fieldIsRequired integerValue]) { cell.barBelowCodeLabel.text = [fieldName stringByAppendingString:#"*"] ; } else { cell.barBelowCodeLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.barBelowCodeLabel.text]; } if ([[_formDataDic allKeys] containsObject:cell.fieldId]) { [cell.barCodeBelow setTitle:NSLocalizedString(#"Change BAR Code", Nil) forState:UIControlStateNormal]; [cell.barCodeFrontBtn setTitle:NSLocalizedString(#"Change BAR Code", Nil) forState:UIControlStateNormal]; } } break; case BARCODEEXTERNAL: { if (![fieldOrientation integerValue]) { [cell.barCodeExternalFrontView setHidden:NO]; [cell.barCodeExternalBelowView setHidden:YES]; if (![fieldIsRequired integerValue]) { cell.barCodeFrontExternalLabel.text = [fieldName stringByAppendingString:#"*"]; } else { cell.barCodeFrontExternalLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.barCodeFrontExternalLabel.text]; }else { [cell.barCodeExternalFrontView setHidden:YES]; [cell.barCodeExternalBelowView setHidden:NO]; if (![fieldIsRequired integerValue]) { cell.barCodeBelowExternalLabel.text = [fieldName stringByAppendingString:#"*"] ; } else { cell.barCodeBelowExternalLabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.barCodeBelowExternalLabel.text]; } } break; case MULTIPLEATTACHMENT: { if (![fieldOrientation integerValue]) { [cell.multiAttachmentFronView setHidden:NO]; [cell.multiAttachmentBelowView setHidden:YES]; if (![fieldIsRequired integerValue]) { cell.multiAttachementFrontlabel.text = [fieldName stringByAppendingString:#"*"]; } else { cell.multiAttachementFrontlabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.multiAttachementFrontlabel.text]; }else { [cell.multiAttachmentFronView setHidden:YES]; [cell.multiAttachmentBelowView setHidden:NO]; if (![fieldIsRequired integerValue]) { cell.multiAttachementBelowlabel.text = [fieldName stringByAppendingString:#"*"] ; } else { cell.multiAttachementBelowlabel.text = fieldName; } [_fieldIdDic setObject:cell.fieldId forKey:cell.multiAttachementBelowlabel.text]; } } break; } } else { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"DialogCustomCell" owner:self options:nil]; cell = (DialogCustomCell *)[nib objectAtIndex:SUBMIT]; cell.delegate = self; } }return cell; }
NSTimer stops when we click on ScrollView
In my app am using UIScrollView which is having UIImageView(20) to add images iused the - (void)populateScrollView method. - (void)populateScrollView { TonifyAppDelegate *appDelegate = (TonifyAppDelegate *)[UIApplication sharedApplication].delegate; double x1 = 0, y1 = 3; NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; NSMutableArray *getEffectsImageData = [ud objectForKey:#"getimageeffects"]; imageViewsArray = [[NSMutableArray alloc] initWithCapacity:[getEffectsImageData count]]; for(int i = 0; i < [getEffectsImageData count]; i++) { NSString *sfxUrlFileName = [ [getEffectsImageData objectAtIndex:i] lastPathComponent]; NSLog(#"sfxUrlFileName: %#", sfxUrlFileName); NSData *imageData = [appDelegate readSongDataFromDocsDirectory:sfxUrlFileName]; UIImage *image = [[UIImage alloc] initWithData:imageData]; UIImageView *anImageView = [[UIImageView alloc]initWithImage:image]; CGRect imageFrame = anImageView.frame; imageFrame.origin.x = x1; imageFrame.origin.y = y1; anImageView.frame = CGRectMake(x1, y1, 45, 41); anImageView.userInteractionEnabled = YES; [scrollView addSubview:anImageView]; x1 += anImageView.frame.size.width + 3; if (anImageView && [anImageView isMemberOfClass: [UIImageView class]]) [imageViewsArray addObject: anImageView]; } NSLog(#"imageViewsArray:%#",imageViewsArray); } And to recognize touch in UIScrollView i used UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(singleTapGestureCaptured:)]; [scrollView addGestureRecognizer:singleTap]; Meanwhile am running song by using NSTimer which is like myTimer = [NSTimer scheduledTimerWithTimeInterval:timeinterval target:self selector:#selector(**updatplayer**) userInfo:nil repeats:YES]; [[NSRunLoop mainRunLoop] addTimer:myTimer forMode:NSRunLoopCommonModes]; in updatePlayer method am doing task as follows - (void)updatplayer { TonifyAppDelegate *appDelegate = (TonifyAppDelegate *)[UIApplication sharedApplication].delegate; if (mThresholdVal<mMainLoopLength) { mThresholdVal+=0.5; } else { mThresholdVal = 0.0; } if (divimageView) { [divimageView removeFromSuperview]; } if ([self isHeadsetPluggedIn]==NO) { UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride); } else { UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_None; AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride); } NSString *cu=[NSString stringWithFormat:#"%2.f",audioPlayer.currentTime]; NSString *du=[NSString stringWithFormat:#"%2.f",audioPlayer.duration]; NSLog(#"LOOP cu Duration = %#",cu); NSLog(#"LOOP du = %#",du); int curenttime=(int)[cu intValue]; NSLog(#"LOOP current Duration = %2.f",audioPlayer.duration); if(curenttime==0) { [audioPlayer play]; x=20; } mixdata = [NSMutableDictionary dictionary]; { [activityIndicator stopAnimating]; activityIndicator.hidden = YES; [divimageView setFrame:CGRectMake(x, 87, 12, 144)]; [self.view addSubview:divimageView]; x=x+1; if ((x>19 && x< 480) && appDelegate.songURL != NULL) { [avplayer play]; NSLog(#"mixdata:%#", mixdata); } else if((x>19 && x< 480) && (appDelegate.songIntroUrl || appDelegate.songMidUrl || appDelegate.songChorusUrl) ) { [audioPlayer play]; } if (x==xCord && yCord<235) { [audioPlayer1 play]; } if (x==recXcord) { recaudioPlayer.volume = 10.0; [recaudioPlayer play]; [activityIndicator stopAnimating]; activityIndicator.hidden = YES; } if(appDelegate.xCordArray!=NULL && [appDelegate.tagArray count]>0) { for(int i = 0; i<[appDelegate.xCordArray count];i++) { if (i == 0){ NSLog(#"sfxCount in i==0......%d",sfxCount); NSLog(#"[appDelegate.xCordArray count] in i==0......%d",[appDelegate.xCordArray count]); NSLog(#"[appDelegate.mMixedSFXTrack2Array count] in i==0......%d",[appDelegate.mMixedSFXTrack2Array count]); if (sfxCount-1 != [appDelegate.xCordArray count]) { if ([appDelegate.xCordArray count] > [appDelegate.mMixedSFXTrack2Array count] ) { mShouldBufferUpdate = TRUE; sfxCount = [appDelegate.xCordArray count]; } } } if (x==[[appDelegate.xCordArray objectAtIndex:i] intValue] && appDelegate.imgDragXCodr<480) { int j = [[appDelegate.tagArray objectAtIndex:i] intValue]; //mShouldBufferUpdate = TRUE; [self getSetSongData:j :x]; [audioPlayer2 play]; } } } if(appDelegate.xCordTrack3Array!=NULL && [appDelegate.track3tagArray count]>0) { for(int i = 0; i<[appDelegate.xCordTrack3Array count];i++) { if (i == 0) { if (sfxCount3-1 != [appDelegate.xCordTrack3Array count]) { if ([appDelegate.xCordTrack3Array count] > [appDelegate.mMixedSFXTrack3Array count] ) { mShouldBuffer3Update = TRUE; sfxCount3 = [appDelegate.xCordTrack3Array count]; } } } if (x==[[appDelegate.xCordTrack3Array objectAtIndex:i] intValue] && appDelegate.imgDragXCodr1<480) { int j = [[appDelegate.track3tagArray objectAtIndex:i] intValue]; [self getSetSongData:j :x]; [trac3AudioPlayer play]; //For SFX Sounds } } } if (x == 480) { x=20; } } } When i click on scrollView it generates an image in UIView(main View) at that time NSTimer is getting paused. How can we solve this. Any one can help or suggest me. Thanks in advance.
Search display controller frame
I am using search display controller in my code for searching. But it is giving some problem. When view is load search bar frame is going out of the view but whenever I am trying to search something it comes in its proper frame which I need. I am unable to recognize the problem in my code. I have attached the images which will make you more clear about the problem. Here is the code for searching: pragma mark UISearchDisplayController Delegate Methods - (void)handleSearchForTerm:(NSString *)searchTerm { searchbar.frame = CGRectMake(391, 28, 586, 44); [self setSavedSearchTerm:searchTerm]; if ([self searchResults] == nil) { NSMutableArray *array = [[NSMutableArray alloc] init]; [self setSearchResults:array]; } [[self searchResults] removeAllObjects]; if ([[self savedSearchTerm] length] != 0) { int i = 0; for (NSString *currentString in [[self contentsList]valueForKey:#"name"]) { if ([currentString rangeOfString:searchTerm options:NSCaseInsensitiveSearch].location != NSNotFound) { [[self searchResults] addObject:currentString]; [[self searchResults] addObject:[[[self contentsList]objectAtIndex:i] objectForKey:#"id"]]; [[self searchResults] addObject:[[[self contentsList]objectAtIndex:i] objectForKey:#"category"]]; NSString *searchcategory = [[[self contentsList]objectAtIndex:i] objectForKey:#"category"]; [[self searchResults] addObject:[[[self contentsList]objectAtIndex:i] objectForKey:#"flavour"]]; [[self searchResults] addObject:[[[self contentsList]objectAtIndex:i] objectForKey:#"price"]]; [[self searchResults] addObject:[[[self contentsList]objectAtIndex:i] objectForKey:#"image"]]; } i++; } } } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { searchbar.frame = CGRectMake(391, 28, 586, 44); [self handleSearchForTerm:searchString]; return YES; } - (void)searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller { searchbar.frame = CGRectMake(391, 28, 586, 44); [self setSearchResults:nil]; [self setSavedSearchTerm:nil]; [[self itemstable_ipad]reloadData]; } -(void)searchmethod { searchbar.frame = CGRectMake(391, 28, 586, 44); [self setContentsList:categoryarray_ipad]; if ([self savedSearchTerm]) { [[[self searchDisplayController] searchBar] setText:[self savedSearchTerm]]; } } please if anyone has idea how to set search bar frame, provide me some solution. Thanks to all.
Thanks for viewing my problem. I have resolved this problem by using searchbar programmatically instead of search display controller.
overlapping issue on table view cell
I am getting overlapping issue while using following code. I used custom cell and normal cell style for this form. Any suggestion is appreciated (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *RSVNIdentifier = #"RSVNCell"; CreateReservationViewCell *cell = (CreateReservationViewCell *)[tableView dequeueReusableCellWithIdentifier:RSVNIdentifier] ; if (cell == nil) { cell = [[[CreateReservationViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RSVNIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } if(indexPath.section == 0) { { if(indexPath.row == 0){ //cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.editing =NO; cell.m_rsvn_name.text =#"Customer"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"reservation"] objectForKey:#"createdBy"]; cell.m_rsvn_value.enabled=NO; return cell; } if(indexPath.row == 1){ cell.m_rsvn_name.text =#"Till"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"reservation"] objectForKey:#"createdDate"]; cell.m_rsvn_value.enabled=NO; return cell; } if(indexPath.row == 2){ //cell.selectionStyle = UITableViewCellSelectionStyleNone; emailTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)]; emailTextField.adjustsFontSizeToFitWidth = YES; emailTextField.font = [UIFont systemFontOfSize:12]; emailTextField.textAlignment= UITextAlignmentRight; emailTextField.keyboardType= UIKeyboardTypeEmailAddress; emailTextField.returnKeyType = UIReturnKeyDone; emailTextField.tag=0; emailTextField.delegate=self; emailTextField.text =[textFields objectAtIndex:0]; cell.m_rsvn_name.text =#"Email"; [cell addSubview:emailTextField]; return cell; } if(indexPath.row == 3){ cell.m_rsvn_name.text =#"Telephone"; phoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)]; phoneTextField.adjustsFontSizeToFitWidth = YES; phoneTextField.font = [UIFont systemFontOfSize:12]; phoneTextField.textAlignment= UITextAlignmentRight; phoneTextField.keyboardType= UIKeyboardTypePhonePad; phoneTextField.delegate=self; phoneTextField.tag=1; phoneTextField.text =[textFields objectAtIndex:1]; cell.m_rsvn_name.text =#"Phone"; [cell addSubview:phoneTextField]; return cell; } if(indexPath.row == 4){ cell.m_rsvn_name.text =#"Internal Note"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"reservation"] objectForKey:#"internalNote"]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.m_rsvn_value.enabled=NO; return cell; } } } else if(indexPath.section == 1){ NSLog(#"%#",unit_details); //[[create_reservation_detail objectAtIndex:0] objectForKey:#"reservation"] objectForKey:#"unitName"]; for (int i=0; i<[unit_details count]; i++) { if(indexPath.row == i){ cell.m_unit_title.text = [[unit_details objectAtIndex:0] objectForKey:#"unitName"]; cell.m_unit_value1.text = [[unit_details objectAtIndex:0] objectForKey:#"nights"]; cell.m_unit_value2.text =[[unit_details objectAtIndex:0] objectForKey:#"adults"]; return cell; } } } else if(indexPath.section == 2){ if(indexPath.row == 0){ cell.m_rsvn_name.text = #"Total Charges"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"charges"] objectForKey:#"totalRoomCharge"]; return cell; } if(indexPath.row == 1){ cell.m_rsvn_name.text = #"10% Tax"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"charges"] objectForKey:#"roomTaxAmount"]; return cell; } if(indexPath.row == 2){ cell.m_rsvn_name.text = #"Total Charges1"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"charges"] objectForKey:#"otherCharge"]; return cell; } if(indexPath.row == 3){ cell.m_rsvn_name.text = #"Total Charges2"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"charges"] objectForKey:#"totalCharge"]; return cell; } if(indexPath.row == 4){ cell.m_rsvn_name.text = #"Total Payments"; //cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"charges"] objectForKey:#"totalPayment"]; return cell; } if(indexPath.row == 5){ cell.m_rsvn_name.text = #"Current Balance"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"charges"] objectForKey:#"currentBalance"]; return cell; } } else if(indexPath.section == 3){ if(indexPath.row == 0){ cell.m_rsvn_name.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"deposit"] objectForKey:#"description"]; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"deposit"] objectForKey:#"amount"]; return cell; } else if(indexPath.row == 1){ cell.m_rsvn_name.text =#"Amount Due"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"deposit"] objectForKey:#"amount_due"]; return cell; } else if(indexPath.row == 2){ cell.m_rsvn_name.text =#"Security Deposit status"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"deposit"] objectForKey:#"securityStatus"]; return cell; } else if(indexPath.row == 3){ cell.m_rsvn_name.text =#"Security Deposit Due"; cell.m_rsvn_value.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"deposit"] objectForKey:#"securityStatus_due"]; return cell; } else if(indexPath.row == 4){ static NSString *SecurityCellIdentifier = #"Cell"; UITableViewCell *security_cell = [tableView dequeueReusableCellWithIdentifier:SecurityCellIdentifier]; if (security_cell == nil) { security_cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:SecurityCellIdentifier] autorelease]; } // Configure the cell... security_cell.textLabel.text = #"Security Deposit Instruction:"; security_cell.textLabel.font = [UIFont systemFontOfSize:14]; security_cell.detailTextLabel.text =[[[create_reservation_detail objectAtIndex:0] objectForKey:#"deposit"] objectForKey:#"instruction"]; security_cell.textLabel.font = [UIFont systemFontOfSize:14]; security_cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap; security_cell.detailTextLabel.numberOfLines = 0; [security_cell.detailTextLabel sizeToFit]; return security_cell; } } else if(indexPath.section == 4){ static NSString *Payment_CellIdentifier = #"Payment_Cell"; UITableViewCell *pay_cell = [tableView dequeueReusableCellWithIdentifier:Payment_CellIdentifier]; if (!pay_cell) { pay_cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:Payment_CellIdentifier] autorelease]; } pay_cell.textLabel.font=[UIFont systemFontOfSize:14]; if(indexPath.row == 0){ if ([[[[create_reservation_detail objectAtIndex:0] objectForKey:#"payment"] objectForKey:#"paypal"] isEqualToString:#""]) { pay_cell.accessoryType=UITableViewCellAccessoryNone; pay_cell.selectionStyle = UITableViewCellSelectionStyleNone; } else { pay_cell.accessoryType = UITableViewCellAccessoryCheckmark; } NSLog(#"accessory type ->%d",cell.accessoryType); pay_cell.textLabel.text = #"PayPal"; pay_cell.selectionStyle = UITableViewCellSelectionStyleGray; pay_cell.detailTextLabel.text=[[[create_reservation_detail objectAtIndex:0] objectForKey:#"payment"] objectForKey:#"paypal"]; pay_cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap; pay_cell.detailTextLabel.numberOfLines = 0; [pay_cell.detailTextLabel sizeToFit]; return pay_cell; } if(indexPath.row == 1){ if ([[[[create_reservation_detail objectAtIndex:0] objectForKey:#"payment"] objectForKey:#"manualCheck"] isEqualToString:#""]) { pay_cell.accessoryType=UITableViewCellAccessoryNone; pay_cell.selectionStyle = UITableViewCellSelectionStyleNone; } else { pay_cell.accessoryType = UITableViewCellAccessoryCheckmark; } NSLog(#"accessory type ->%d",cell.accessoryType); pay_cell.textLabel.text = #"Manual Check"; pay_cell.selectionStyle = UITableViewCellSelectionStyleGray; pay_cell.selectionStyle = UITableViewCellSelectionStyleGray; pay_cell.detailTextLabel.text=[[[create_reservation_detail objectAtIndex:0] objectForKey:#"payment"] objectForKey:#"manualCheck"]; pay_cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap; pay_cell.detailTextLabel.numberOfLines = 0; [pay_cell.detailTextLabel sizeToFit]; return pay_cell; } if(indexPath.row == 2){ if ([[[[create_reservation_detail objectAtIndex:0] objectForKey:#"payment"] objectForKey:#"tranfer"] isEqualToString:#""]) { pay_cell.accessoryType=UITableViewCellAccessoryNone; NSLog(#"accessory type ->%d",UITableViewCellAccessoryCheckmark); pay_cell.selectionStyle = UITableViewCellSelectionStyleNone; } else { pay_cell.accessoryType = UITableViewCellAccessoryCheckmark; } NSLog(#"accessory type ->%d",UITableViewCellAccessoryCheckmark); pay_cell.textLabel.text = #"Wire / Transfer"; pay_cell.selectionStyle = UITableViewCellSelectionStyleGray; pay_cell.selectionStyle = UITableViewCellSelectionStyleGray; pay_cell.detailTextLabel.text=[[[create_reservation_detail objectAtIndex:0] objectForKey:#"payment"] objectForKey:#"tranfer"]; pay_cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap; pay_cell.detailTextLabel.numberOfLines = 0; [pay_cell.detailTextLabel sizeToFit]; return pay_cell; } if(indexPath.row == 3){ other.borderStyle=UITextBorderStyleRoundedRect; other.placeholder=#"other\n"; other.autocorrectionType=UITextAutocorrectionTypeNo; other.delegate=self; other.autocapitalizationType=UITextAutocapitalizationTypeNone; other.hidden=[[textFields objectAtIndex:2] intValue]; other.returnKeyType = UIReturnKeyDone; [pay_cell addSubview:other]; pay_cell.textLabel.text = #"Other"; pay_cell.selectionStyle = UITableViewCellSelectionStyleGray; return pay_cell; } } else { if(indexPath.row == 0){ static NSString *Button_CellIdentifier = #"Button_Cell"; UITableViewCell *button_cell = [tableView dequeueReusableCellWithIdentifier:Button_CellIdentifier]; if (button_cell == nil) { button_cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:Button_CellIdentifier] autorelease]; } button_cell.backgroundView= [[[UIImageView alloc] initWithImage:[UIImage imageNamed:#"save_reservation_button.png"]] autorelease]; button_cell.selectedBackgroundView= [[[UIImageView alloc] initWithImage:[UIImage imageNamed:#"save_reservation_button.png"]] autorelease]; return button_cell; } } return nil; } Regards, sathish
You should make custom view added to cell inside the block if (cell == nil) { cell = [[[CreateReservationViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:RSVNIdentifier] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleNone; // deal with your custom views here } For example, this codes will make one more sub-views on the cell. If this cell is come from dequeue, it already has a emailTextField added on this cell, and following code will add one more emailTextField on this cell. if(indexPath.row == 2){ //cell.selectionStyle = UITableViewCellSelectionStyleNone; emailTextField = [[UITextField alloc] initWithFrame:CGRectMake(110, 10, 185, 30)]; ... // assign emailTextField settings cell.m_rsvn_name.text =#"Email"; [cell addSubview:emailTextField]; return cell; }
where overlapping is happening. means on cell item or anywhere else. and in code somewhere u using [cell addSubView] instead of that use [cell.contentView addSubView]