表视图单元格重叠问题
我在使用以下代码时遇到重叠问题。我为此表单使用了自定义单元格和普通单元格样式。
任何建议表示赞赏
(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;
}
问候, 萨蒂什
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该将自定义视图添加到块内的单元格中,
例如,此代码将在单元格上再创建一个子视图。如果此单元格来自出队,则它已经在此单元格上添加了一个 emailTextField,并且以下代码将在此单元格上再添加一个 emailTextField。
You should make custom view added to cell inside the block
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.
发生重叠的地方。意味着在单元格项目或其他任何地方。并在代码中使用 [cell addSubView] 而不是使用 [cell.contentView addSubView]
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]