i have a problem, i want set text of a UILabel or UItextView or another IBOUTLET objects,but i can do it only in the viewwillappear and viewdidload method, if i set text in another method in the code don't change nothing, here is an example:
i have a method that retrieve string from another class, and then i want set this string in my uilabel:
- (void)setDetailItem:(id)newDetailItem
{
if (detailItem != newDetailItem) {
NSLog(@"SetDetailItem");
[detailItem release];
detailItem = [newDetailItem retain];
detailString = [[FindStringClass alloc] init];
// Update the view.
detailItem = [detailString searchStringFor:detailItem.name];
if (detailItem) {
//
NSLog(@"setDetail: %@",detailItem.stringName);
[self configureView];
}
}
}
- (void)configureView {
NSLog(@"configure view: %@",detailItem.stringName);
mySerialTitle.text = detailItem.stringName;
}
the NSLog work, and i can see my string in the console, but the text in view don't change, instead if i set a simple text in the ViewWillAppear or viewDidLoad method work, so the connection with the IBOOutlets are right, like this:
- (void)viewDidLoad
{
mySerialTitle.text = @"CIAO";
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
This is the call function where i call the setDeatItem from another view:
self.searchResultViewController.detailItem = [myArray objectAtIndex:[indexPath row]];
[self.navigationController pushViewController:self.searchResultViewController animated:YES];
anyone can help me?
EDIT: This is the NSLog where the method are called:
2012-03-19 12:51:02.617 TestApp[292:b603] SetDetailItem
2012-03-19 12:51:06.161 TestApp[292:b603] setDetail: Chicken
2012-03-19 12:51:06.162 TestApp[292:b603] configure view: Chicken
2012-03-19 12:51:06.175 TestApp[292:b603] View DidLoad
i call the searchviewcontroller view from a Tableviewcontroller i press on a row and then call the new view and pass the attribute.