I'm developing an iPhone 3.1.3 application and I have the following header file:
#import <UIKit/UIKit.h>
@interface VoiceTest01ViewController : UIViewController {
IBOutlet UITextView *volumeTextView;
BOOL isListening;
NSTimer *soundTimer;
}
@property (nonatomic, retain) IBOutlet UITextView *volumeTextView;
@property (nonatomic, retain) NSTimer *soundTimer;
- (IBAction)btnStartClicked:(id)sender;
@end
And .m file is:
#import "VoiceTest01ViewController.h"
@implementation VoiceTest01ViewController
@synthesize volumeTextView;
@synthesize soundTimer;
...
How can I set isListening up to false at start?
All instance variables are set to 0/NULL/nil by default, which in the case of a BOOL means NO. So it already is NO (or false) by default.
If you need any other value then you need to override the designated initializer(s), most of the time init, and set the default value there.
Set the boolean value in your viewDidLoad
- (void)viewDidLoad {
isListening = NO;
//Something
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With