Hi Guys,
I am getting a problem which I could not able to spot where it was...
My problem is Im having a textfield in the controller and when I am changing the text in the textfield the setter for particular object is calling which is not related to this textfield.
My code for this is:
This is the setter which was calling when changing the text in the textfield. -(NSString* )price { return price;
}
- (void)setPrice:(NSString *)aPrice
{
printf("\n Price is modified to :%s", [aPrice UTF8String]);
if ((!price && ! aPrice) || (price && aPrice && [price isEqualToString: aPrice])) return;
[price release];
price = [aPrice copy] ;
}
And this is the code related to the textfield:
if(indexPath.section == 0)
{
UILabel *currLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 8, 60, 30)];
currLabel.backgroundColor = [UIColor whiteColor];
currLabel.font = [UIFont systemFontOfSize:15];
NSString *str = @"1";
if(isEstimate == YES)
{
str = [str stringByAppendingString:addEstimate.estimateCurrencyCode];
}
else
{
str = [str stringByAppendingString:addInvoice.invoiceCurrencyCode];
}
str = [str stringByAppendingString:@" ="];
currLabel.text = str;
[elementView addSubview:currLabel];
[currLabel release];
exchangeRatetextfield1=[[UITextField alloc]initWithFrame:CGRectMake(71,13, 180, 30)];
exchangeRatetextfield1.textColor = [UIColor blackColor];
exchangeRatetextfield1.backgroundColor = [UIColor whiteColor];
exchangeRatetextfield1.font = [UIFont systemFontOfSize:15];
exchangeRatetextfield1.returnKeyType=UIReturnKeyDone;
exchangeRatetextfield1.autocorrectionType = UITextAutocorrectionTypeNo;
exchangeRatetextfield1.keyboardType = UIKeyboardTypeNumberPad;
exchangeRatetextfield1.adjustsFontSizeToFitWidth = YES;
exchangeRatetextfield1.keyboardAppearance = UIKeyboardAppearanceAlert;
if(isEstimate == YES)
{
if(addEstimate.estimateExchangeRate == nil)
{
exchangeRatetextfield1.text = @"1";
}
else
{
exchangeRatetextfield1.text = [addEstimate.estimateExchangeRate copy];
}
}
else
{
if(addInvoice.invoiceExchangeRate == nil)
{
exchangeRatetextfield1.text = @"1";
}
else
{
exchangeRatetextfield1.text = [addInvoice.invoiceExchangeRate copy];
}
}
[elementView addSubview:exchangeRatetextfield1];
}
Guys can anyone please help me to get out of this. Im wasting so much of time on this by investigating.
Anyone's help will be much appreciated. Thank You Monish Kumar