Je crée UIAlertView dans ma fonction, le problème est qu'il montre beaucoup de temps lorsque la fonction fonctionne, comment puis-je créer une déclaration if
pour afficher une seule fois comme si UIAlertView
montre pas montrer plus. en CLa vue d'alerte montre Beaucoup de temps pas une fois
- (void)showAlert {
_myAlertView = nil;
_myAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Call_On_Hold",nil)
message:NSLocalizedString(@"Please_Wait",nil)
delegate:self
cancelButtonTitle:NSLocalizedString(@"Close_call",nil)
otherButtonTitles:nil, nil];
_myAlertView.tag = myAlertViewsTag;
[_myAlertView show];
}
objectif
Voici la fonction que mon UIAlertView apparaissent continuellement au lieu d'une seule fois.
- (void) trafficTimerRun:(NSTimer*)theTimer
{
++ trafficTimerTicks;
pjmedia_rtcp_stat stat;
if (!get_stream_info([call_id intValue], &stat)) {
return;
}
LogDebug(TAG_SIP, @"Got %d bytes on stream 0 (previous: %d)", stat.rx.bytes, prev_bytes);
if (stat.rx.bytes == prev_bytes) {
if (trafficTimerTicks >= 10) {
// Steve-note: Here we need to show a pop-up message when the call in on hold when the trafficTimerTicks run.
[self showAlert];
LogError(TAG_SIP, @"No traffic received, hanging up");
// [theTimer invalidate];
// broken = YES; Steve note: The call shouldnt broke.
// [self hangup]; Steve note: The call shouldnt hangup.
}
}
}
merci à l'avance.
Side -note: 'UIAlertView' est obsolète, utilisez' UIAlertController' à la place. –