PDA

View Full Version : problem with refresh uiview and update variable




yowsing
Apr 27, 2011, 10:31 PM
hi everyone,
i encounter the following issue, where i have 1 UIView (FirstView) call another UIView (SecondView), then after that i would wanted to update the variable in the firstview and refresh the first view but i seems not able to find a way to do it, can anyone guide me on that?

FirstView.h

@interface FirstView : UIViewController <UIApplicationDelegate, UITableViewDataSource, UITableViewDelegate>{
NSMutableArray *arrTaskList;

}
@property(nonatomic,retain) IBOutlet NSMutableArray *arrTaskList;

@end



FirstView.m
(I display the second view using the addsubview method)


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0)
{

SecondView *vwSecView = [[SecondView alloc] init];
[self.view addSubview:vwSecView.view];
}

}



SecondView.m
(After user complete the task, they click a button

-(IBAction) fncTaskCompleted:(id)sender
{
[self.view removeFromSuperview];

At here
I Would like to Update my FirstView variable: arrTaskList
And
Refresh FirstView

}



i not able to use the below method because the xcode told me it will not response to the delegate method...

FirstView *delegate = (FirstView*)[UIApplication shareApplication] delegate];
[delegate.arrTaskList removeObject:0];


can anyone guide me a direction on how to accomplish this?
thank you...



Nokaru
May 10, 2011, 10:16 PM
hi,

i have exactly the same problem. please let me know if you find a solution.

thanks!