시, 분 및 초에 대해 "secondsLeft"및 "unused variable"에 대해 "local declaration instances variables"오류가 있습니다. 이 웹 사이트에서 제공 할 수있는 도움에 대해 미리 감사드립니다.로컬 선언은 인스턴스 변수/사용하지 않는 변수 경고를 숨 깁니다.
.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