i am using tabbarcontroller. In tabbar having one view.In that tab i call one function using Nstimer it open another viewcontroller.
//Third.m
- (void)viewDidLoad
{
[super viewDidLoad];
[self TimerStart];
}
-(void)TimerStart
{
TesttabAppDelegate *delegate = (TesttabAppDelegate *) [[UIApplication sharedApplication] delegate];
delegate.timer1 = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(targetMethod) userInfo:nil repeats:YES];
}
-(void)targetMethod
{
[self Stoptimer];
First * sVC = [[First alloc] initWithNibName:@"First" bundle:[NSBundle mainBundle]];
[self presentModalViewController:sVC animated:YES];
}
-(void) Stoptimer
{
TesttabAppDelegate *delegate = (TesttabAppDelegate *) [[UIApplication sharedApplication] delegate];
[delegate
.timer1 invalidate];
}
Opened viewcontrller having one button.when user click that button i closed the view and call Nstimer.
//First.m
- (IBAction) Action:(id)sender
{
[self dismissModalViewControllerAnimated:YES];
Third *th=[[Third alloc]init];
[th TimerStart];
[th release];
};
The problem is first time the view opened and closed but second time view could not open.
second time i start timer in button action means it works fine...
Anyone Please help me..
Still i didn't get any solution...