2013年5月7日 星期二

UIActionSheetDelegate event handlers選單按鈕的事件要用delegate來實現

// UIActionSheetDelegate event handlers


- (void) actionSheet:(UIActionSheet*)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    [self mainOptionClickedButtonAtIndex:buttonIndex];
}


- (void) mainOptionClickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (flashIx == buttonIndex)
    {
        BOOL newFlashMode = ![qUtils cameraTorchOn];
        [qUtils cameraSetTorchMode:newFlashMode];
    }
    else if (selectTargetIx == buttonIndex)
    {
        selectedTarget = (selectedTarget + 1) % [qUtils.targetsList count];       
        DataSetItem *targetEntry = [qUtils.targetsList objectAtIndex:selectedTarget];
        [qUtils activateDataSet:targetEntry.dataSet];
    }
    else if (autofocusContIx == buttonIndex)
    {
        // toggle camera continuous autofocus mode
        BOOL newContAFMode = ![qUtils cameraContinuousAFOn];
        [qUtils cameraSetContinuousAFMode:newContAFMode];
    }
    else if (autofocusSingleIx == buttonIndex)
    {
        [qUtils cameraPerformAF];
    }
       
    self.view.userInteractionEnabled = NO;
 }


沒有留言:

張貼留言