你好,我正在使用一個庫。它有一些嵌入枚舉的選項,但我不知道如何配置它們。該圖書館被稱爲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;
非常感謝您!
我還是不明白。例如,如何將PPRevealSideOptionsBounceAnimations更改爲0,以便我可以關閉彈跳? – Devfly 2012-07-16 09:02:20
選項存儲在int中,並採用像'11001000' - 這對應於PPRevealSideOptionsShowShadows + PPRevealSideOptionsBounceAnimations + PPRevealSideOptionsResizeSideView。所以你應該把這個int改爲'10001000'。因此,您只需使用按位操作來更改具體位的值,即可創建'obj.options = obj.options&〜PPRevealSideOptionsBounceAnimations'。 – 2012-07-16 09:08:01
按位運算符真的嗎?這是非常低級的解決方案。它確實有效,但現在我的影子與其他選項一起消失了。 – Devfly 2012-07-16 16:23:12