我看到使用布尔属性作为标志是自定义的.类似的东西:
@property (nonatomic) BOOL commaAlreadyIntroduced;
Run Code Online (Sandbox Code Playgroud)
我需要这样的东西,但至少有3或4个状态.
我可以使用枚举吗?
独立枚举应如下所示:
typedef enum stackState{
empty, oneOperand, operandAndOperator, fullStack
}stackState;
Run Code Online (Sandbox Code Playgroud)
我有一个音频播放器应该能够播放多种音频格式.该应用程序正在使用BASS音频库,它需要一些导出.以下是格式.除了.mov(仅音频)格式的文件外,一切正常.
关于正确解决方法的任何想法?
exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetPassthrough];
if (nil == exportSession)
@throw [NSException exceptionWithName:TSUnknownError reason:@"Couldn't create AVAssetExportSession" userInfo:nil];
if ([[assetURL pathExtension] compare:@"mp3"] == NSOrderedSame) {
[self doMp3ImportToFile:destURL completionBlock:completionBlock];
return;
}
exportSession.outputURL = destURL;
// set the output file type appropriately based on asset URL extension
if ([[assetURL pathExtension] compare:@"m4a"] == NSOrderedSame) {
exportSession.outputFileType = AVFileTypeAppleM4A;
} else if ([[assetURL pathExtension] compare:@"wav"] == NSOrderedSame) {
exportSession.outputFileType = AVFileTypeWAVE;
} else if ([[assetURL pathExtension] compare:@"aif"] == NSOrderedSame) {
exportSession.outputFileType = AVFileTypeAIFF; …Run Code Online (Sandbox Code Playgroud)