PDA

View Full Version : Not able to set the values to property from another class




asifpv
Apr 14, 2009, 10:20 AM
Hi Friends,

i am not able to set the property values from another class.

Please see my code,
-------------------------------
----- FNController.m -------
Am calling below method from FNView.xib, after submitting save button

-(void) save_Clickedid)sender {

NSString* fname = self.tFirstName.text;
NSString* lname = self.tLastName.text;

AddViewController *avcObj = [[AddViewController alloc] init];

[avcObj setTxtNameLabel:fname :lname];

[self.navigationController dismissModalViewControllerAnimated:YES];
// Navigating to AddView.xib
}


here is am setting the properties
---- AddViewController.m----


- (void) setTxtNameLabelNSString *)fn: (NSString *)ln{

self.txtFirstName.text = fn;

self.txtLastName.text = ln;

NSString* name = [[fn stringByAppendingString:@" "] stringByAppendingString:ln];

int intVal = name.length;

if(intVal == 0)
self.txtName.text = @"No name";
else
self.txtName.text = name;

}


after doing this my UILabel (ie.txtName) not getting updated..but when i debug the program am able to get the value in "name" hence it going to else part of the if statement.

Anyone knowing please help me to do this...

Thanks,
Asif