tags:

views:

22

answers:

0

Hello,

I am working in table view where i am providing a form,user need to fill up about 15 values.My problem is like if the user writes his name in 1st cell's text field,the same value gets overwritten in the 12th cell's text field.

kindly note that i am using the method [cell addSubview:txtfirstname]; method to fetch data to table view. Also at the time add even occurs,the textfield values are copied to string variable.

My code :

switch (indexPath.row) 
{
    case 0:     
    cell.textLabel.font = [UIFont boldSystemFontOfSize:13];
    cell.textLabel.text =   @"Number of SMS :";
    txtsmsno = [[UILabel alloc] initWithFrame:CGRectMake(170, 11, 250, 20)];
    txtsmsno.font = [UIFont boldSystemFontOfSize:13];
    txtsmsno.text = [NSString stringWithFormat:@" %@",smsno];       
    [cell addSubview:txtsmsno];
    break;
case 1:
cell.textLabel.font = [UIFont boldSystemFontOfSize:13];
cell.textLabel.text =   @"Total Amount Charged :";
txtcharges = [[UILabel alloc] initWithFrame:CGRectMake(170, 11, 250, 20)];
txtcharges.font = [UIFont boldSystemFontOfSize:13];
txtcharges.text = [NSString stringWithFormat:@" %@",charges];
[cell addSubview:txtcharges];
break;

what should i do to resolve my this problem?i think my frame is getting overriden.

Thanks in advance.