I'm not going to say that your approach is bad, but it is slightly related to the starting embryo of the โdivineโ method, which is a method that tries to do everything. However, for the number of options that you have in your code, I would say that it works great.
But sharing enum around is very simple. Just put them in your .h file and import it where necessary. You can include the .h file as one of the file types in the "C and C ++" section.
, , #, , , , .h "" . Objective-C ( C ++) , .
, enum :
typedef enum {
kSetPlaybackType = 0,
kSetAllNotesOn,
kSetAllNotesOff,
kSetVelocity,
kSetDuration
} SetEnumType;
enum typedef, . .. :
int varName = kSetAllNotesOn;
:
SetEnumType varName = kSetAllNotesOn;
XCode , , , varName , .
, varNum enum int , .
,
- (void)barPropertyAction:(SetEnumType)action withParam:(NSNumber *)param
, ( , enum int). ,
- (void)barPropertyAction:(int)action withParam:(NSNumber *)param
{
switch ((SetEnumType)action) {
case kSetPlaybackType:
playbackType = [param intValue];