I am having a delegate function which asks for UIActivityIndicatorViewStyle
from delegate.
@protocol StatusViewCustomizationDelegate <NSObject>
@optional
-(UIActivityIndicatorViewStyle)activityIndicatorStyle;
@end
Inside a private function I check if delegate responds to this selector and if it responds I call the method. Below is the code:
-(void)configureView
{
UIActivityIndicatorViewStyle activityIndicatorStyleFromDelegate;
if ([self.delegate respondsToSelector:@selector(activityIndicatorViewStyle)])
{
activityIndicatorStyleFromDelegate = [self.delegate activityIndicatorStyle];
}
}
What is the correct way to check the enum value I received in activityIndicatorStyleFromDelegate
variable is a valid UIActivityIndicatorViewStyle
enum value?
Edit:
UIActivityIndicatorViewStyle
is an iOS defined enum.
typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) {
UIActivityIndicatorViewStyleWhiteLarge,
UIActivityIndicatorViewStyleWhite,
UIActivityIndicatorViewStyleGray,
};