簡體   English   中英

更改枚舉類型值

[英]Change enum type value

你好我正在使用一個庫。 它有一些嵌入在枚舉中的選項,但我無法弄清楚如何配置它們。 該庫名為PPRevealSideViewController 它有一個屬性:

@property (nonatomic, assign) PPRevealSideOptions options;

這是枚舉代碼:

enum {
    PPRevealSideOptionsNone = 0,
    PPRevealSideOptionsShowShadows = 2 << 1, /// Disable or enable the shadows. Enabled by default
    PPRevealSideOptionsBounceAnimations = 1 << 2, /// Decide if the animations are boucing or not. By default, they are
    PPRevealSideOptionsCloseCompletlyBeforeOpeningNewDirection = 1 << 3, /// Decide if we close completely the old direction, for the new one or not. Set to YES by default
    PPRevealSideOptionsKeepOffsetOnRotation = 1 << 4, /// Keep the same offset when rotating. By default, set to no
    PPRevealSideOptionsResizeSideView = 1 << 5, /// Resize the side view. If set to yes, this disabled the bouncing stuff since the view behind is not large enough to show bouncing correctly. Set to NO by default
};
typedef NSUInteger PPRevealSideOptions;

非常感謝你!

obj.options = opt0 | opt1 | ... etc

例如: obj.options = PPRevealSideOptionsBounceAnimations | PPRevealSideOptionsResizeSideView; obj.options = PPRevealSideOptionsBounceAnimations | PPRevealSideOptionsResizeSideView;

我為此目的制作了這個控制器的文檔。 好吧,我的不好,這個方法不是很突出,但確實存在:您可以使用- (void) resetOption:(PPRevealSideOptions)option; (后面是低級別: _options ^= option; )或者使用- (void) setOption:(PPRevealSideOptions)option 甚至有一個setOptionS方法;)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM