2013-06-13 3 views
1

여기에서 다른 스레드를 읽음으로써 이것을 알아 내려고했지만, 지금까지는 아무 것도 시도 할 수 없었습니다. 연결을 이해하지 못하는 초보자이거나 관련성이없는 경우 - 잘 모르겠습니다.타이머가있는 selectorTimerWithTimeInterval에 대한 알려진 클래스 메서드가 없습니다.

나는 2 타이머가있는 iPhone 응용 프로그램을 만들고 있습니다.

타이머가 동작하도록 소스 코드를 얻는 중입니다. 에서

#import "FlipsideViewController.h" 
#import "UIKit/UIKit.h" 

@interface MainViewController : UIViewController <FlipsideViewControllerDelegate, UIPopoverControllerDelegate> { 

IBOutlet UILabel *timerP1; 
IBOutlet UILabel *timerP2; 

NSTimer *myTimerP1; 
NSTimer *myTimerP2; 
} 

- (IBAction)startP1; 
- (IBAction)stopP1; 
- (IBAction)resetP1; 

- (void)showActivityP1; 

- (IBAction)startP2; 
- (IBAction)stopP2; 
- (IBAction)resetP2; 

- (void)showActivityP2; 

@property (strong, nonatomic) UIPopoverController *flipsidePopoverController; 

@end 

: 난 당신이 내 MainViewController.h에서 타이머를

을 사용자 정의 할 수 있습니다 나중에 설정에 대한 플립 사이드 (사용하고자으로

나는, 엑스 코드에서 플립 사이드 응용 프로그램 템플릿을 사용 내 MainViewController.m :

@interface MainViewController() 

@end 

@implementation MainViewController 

- (IBAction)startP1{ 

myTimerP1 = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(showActivityP1) userinfo:nil repeats:YES]; 

} 
- (IBAction)stopP1{ 

[myTimerP1 invalidate]; 
} 
- (IBAction)resetP1{ 

timerP1.text = @"60"; 
} 

- (void)showActivityP1;{ 

int currentTimeP1 = [timerP1.text intValue]; 
int newTimeP1 = currentTimeP1 - 1; 
timerP1.text = [NSString stringWithFormat:@"%d", newTimeP1]; 
} 
- (IBAction)startP2{ 

} 
- (IBAction)stopP2{ 

} 
- (IBAction)resetP2{ 

} 

- (void)showActivityP2{ 

} 

내가 얻을 오류 "알려진 없음 선택을위한 클래스 메소드 'scheduledTimerWithTimeInterval : 대상 : 선택 : 사용자 정보 : 반복 :'

여기서 내가 뭘 잘못하고 있니?

답변

0

내가 뭘 잘못하고 있니?

글쎄, 솔직히 잘못된 것은 자동 완성을 사용하지 않는 것입니다. 작은 오타이므로 걱정할 필요가 없습니다.

userinfouserInfo

그래서 전체 호출이된다 (자본 I 주)해야한다 :

[NSTimer scheduledTimerWithTimeInterval:1.0 
           target:self 
           selector:@selector(showActivityP1) 
           userInfo:nil 
           repeats:YES]; 

오와 방법에 의해 - (void)showActivityP1;{...} 그냥 ;

드롭, 당신에게뿐만 아니라 문제의 원인이됩니다
+0

대단히 감사합니다 :) 그 자동 완성 기능을 사용하려고합니다. 더 익숙해 져야합니다. – Ensey

+0

환영합니다 :) – Alladinian

관련 문제