사용자가 앱을 실행할 때 표시되는 간단한 UIAlertView
이 있습니다. 이 구조는 다음과 같습니다.UIAlertView가 여러 번 표시됩니다.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Welcome!", "")
message:NSLocalizedString(@"This is a welcome message.", "")
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
질문은, 예를 들어 매 5 회마다 표시하도록 사용자 정의 할 수 있습니까?
는int runCount = [[NSUserDefaults standardUserDefaults] integerForKey:@"AppRunCount"] + 1
[[NSUserDefaults standardUserDefaults] setInteger:runCount forKey:@"AppRunCount"];
if (runCount <= 5) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Welcome!", "")
message:NSLocalizedString(@"This is a welcome message.", "")
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
}
는 는
당신은 viewDidLoad
에 위의 코드를 추가 할 수 있습니다, 사전에
감사)
'매 5 회 실행 '- 앱 실행을 5 회마다 시작한다는 의미입니까? – CAMOBAP
"매 5 회 실행"에 대해 좀 더 명확하게 표현할 수 있습니까? – mozkarakoc
그래, 매 5 회 앱 시작 실행;) viewDidLoad에 있습니다. – Icarox