我有一個「本地聲明隱藏實例變量」錯誤的「secondsLeft」和「未使用的變量」小時,分鐘和秒。預先感謝您提供的任何幫助。本地聲明隱藏實例變量/未使用的變量警告
.h文件中
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BT_viewController.h"
@interface BT_screen_blank : BT_viewController {
NSTimer *timer;
IBOutlet UILabel *myCounterLabel;
}
@property (nonatomic, retain) UILabel *myCounterLabel;
@property (nonatomic) int secondsLeft;
@property (nonatomic) int minutes;
@property (nonatomic) int hours;
@property (nonatomic) int seconds;
-(void)updateCounter:(NSTimer *)theTimer;
-(void)countdownTimer;
@end
.m文件
@implementation BT_screen_blank
@synthesize myCounterLabel;
@synthesize secondsLeft, hours, minutes, seconds;
//viewDidLoad
-(void)viewDidLoad{
[BT_debugger showIt:self:@"viewDidLoad"];
[super viewDidLoad];
int hours, minutes, seconds;
int secondsLeft;
secondsLeft = 16925;
[self countdownTimer];
}
- (void)updateCounter:(NSTimer *)theTimer {
if(secondsLeft > 0){
secondsLeft -- ;
hours = secondsLeft/3600;
minutes = (secondsLeft % 3600)/60;
seconds = (secondsLeft %3600) % 60;
myCounterLabel.text = [NSString stringWithFormat:@"%02d:%02d:%02d", hours, minutes, seconds];
}
else{
secondsLeft = 16925;
}
}
聲明感謝了很多答覆我的問題的快速響應 - 錯誤信息都沒有了! – user1796454