tags:

views:

24

answers:

1

Hi, I have a problem to access the view methods from his UIViewController. I started programming in xcode only 2 weeks ago and I have to modify a program made by an other person.

The UIView was drag and drop in interface builder in the .xib of the UIViewController and is initialized by the method initWithFrame and drawRect. This view contains a NSTimer which I need to stop when the user click on button close of the navigation bar.

So I have a IBAction in the UIViewController that is activated when button close is pressed. And this method should launch one of the UIView's method but it doesn't work. Xcode detects no error or warning but the code of the UIView is never ran. When I launch the application, everything works fine but this.

UIView.h:

@interface Clock3D : UIView {
...
NSTimer *timer;
NSTimer *timerS;
}
...
@property (retain, nonatomic) NSTimer *timer;
@property (retain, nonatomic) NSTimer *timerS;
...
-(void) doneTest;
@end

UIView.m:

@implementation Clock3D
@synthesize timer, timerS, ...
...
-(void) doneTest{

NSLog(@"arret timerS");
[timerS invalidate];
NSLog(@"arret timer");
[timer invalidate];

}

UIViewController.h:

import "Clock3D.h"

@class Clock3D;

@interface Popup360 : UIViewController {
...
Clock3D *clock3D;
}
...
@property(retain, nonatomic) IBOutlet Clock3D *clock3D; ...
-(IBAction) done;

@end

UIViewController.m:

@implementation Popup360
@synthesize ..., clock3D;

-(IBAction) done{
[clock3D doneTest];
[self dismissModalViewControllerAnimated:YES];
}

So the command [clock3D doneTest] doesn't work (NSLog from doneTest never appear in log) but command [self dismissModalViewControllerAnimated:YES]; works.

Thank you for your response.

A: 

In IB check the type of the property view of Popup360. If she sets to UIView change it to Clock3D.

MathieuF