FCVerticalMenu 0.1.3

FCVerticalMenu 0.1.3

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最后发布2014年12月

Filippo Camillo 维护。




一个可动画且完全可定制的垂直菜单。

FCVerticalMenu Screenshot FCVerticalMenu Demo

需求

Xcode 6 或更高版 Apple LLVM 编译器,iOS 7.0 或更高版 ARC

演示

使用 Xcode 6+ 构建 demo 项目。查看 FCNavigatorViewController,其中所有配置都已完成。

安装

FCVerticalMenu 通过 CocoaPods 提供。

如果您还没有安装 CocoaPods,请先安装

$ [sudo] gem install cocoapods
$ pod setup

切换到您的 Xcode 项目的目录

$ cd /path/to/YourProject
$ touch Podfile
$ edit Podfile

要安装 FCVerticalMenu,只需将以下行添加到您的 Podfile 中

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '7.0'
pod "FCVerticalMenu"

按照常规项目安装

$ pod install

最后,像往常一样,以 .xcworkspace 文件而不是 .xcproject 文件开始工作

$ open YourProject.xcworkspace

示例用法

FCVerticalMenuItem *item1 = [[FCVerticalMenuItem alloc] initWithTitle:@"First Menu" andIconImage:[UIImage imageNamed:@"settings-icon"]];

item1.actionBlock = ^{
    NSLog(@"test element 1");
};


self.verticalMenu = [[FCVerticalMenu alloc] initWithItems:@[item1]];
self.verticalMenu.appearsBehindNavigationBar = YES;

[self.verticalMenu showFromNavigationBar:self.navigationBar inView:self.view];

完全可定制

您可以自定义菜单的外观

@property (strong, readwrite, nonatomic) UICollectionViewFlowLayout *menuLayout;

@property (strong, readwrite, nonatomic) UIColor *shadowColor;
@property (assign, readwrite, nonatomic) CGSize shadowOffset;
@property (assign, readwrite, nonatomic) CGFloat shadowOpacity;
@property (assign, readwrite, nonatomic) CGFloat shadowRadius;
@property (assign, readwrite, nonatomic) CGFloat backgroundAlpha;
@property (strong, readwrite, nonatomic) UIColor *backgroundColor;

@property (strong, readwrite, nonatomic) UIFont *font;
@property (strong, readwrite, nonatomic) UIColor *textColor;
@property (strong, readwrite, nonatomic) UIColor *textShadowColor;
@property (strong, readwrite, nonatomic) UIColor *imageTintColor;
@property (strong, readwrite, nonatomic) UIColor *highlightedBackgroundColor;
@property (strong, readwrite, nonatomic) UIColor *highlightedTextColor;
@property (strong, readwrite, nonatomic) UIColor *highlightedTextShadowColor;
@property (strong, readwrite, nonatomic) UIColor *highlightedImageTintColor;
@property (assign, readwrite, nonatomic) CGFloat borderWidth;
@property (strong, readwrite, nonatomic) UIColor *borderColor;
@property (assign, readwrite, nonatomic) NSTextAlignment textAlignment;

@property (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
@property (assign, readwrite, nonatomic) NSTimeInterval closeAnimationDuration;
@property (assign, readwrite, nonatomic) NSTimeInterval bounceAnimationDuration;
@property (assign, readwrite, nonatomic) BOOL appearsBehindNavigationBar;
@property (assign, readwrite, nonatomic) BOOL bounce;

// only iOS 7+
// liveBlur is automatically activated
//
@property (assign, readwrite, nonatomic) BOOL liveBlur;
@property (strong, readwrite, nonatomic) UIColor *liveBlurTintColor;
@property (assign, readwrite, nonatomic) UIBarStyle liveBlurBackgroundStyle;

委托方法

您还可以利用实现的委托方法。

请记住,在您的控制器中采用代理,并使用 self.verticalMenu.delegate = self; 设置代理。

@protocol FCVerticalMenuDelegate <NSObject>
@optional
-(void)menuWillOpen:(FCVerticalMenu *)menu;
-(void)menuDidOpen:(FCVerticalMenu *)menu;
-(void)menuWillClose:(FCVerticalMenu *)menu;
-(void)menuDidClose:(FCVerticalMenu *)menu;
@end

作者

Filippo Camillo

许可

FCVerticalMenu 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。