Giter Site home page Giter Site logo

hypopmenuview's Introduction


#HyPopMenuView

Platform Language License

关于HyPopMenuView灵感来自于新浪微博App

####示例:
1.效果1 image

2.效果2 image

3.效果3 image

4.效果4 image

###特性(可选)

  • 多种动画效果,参考示例。

  • 转场效果 image image

  • 两种背景颜色 Light & Dark

###原理说明(可选) 1.本项目采用Facebook开源的动画框架-Pop,有兴趣的朋友可以去了解下。

下载安装

安装方法:
将下载好的项目提取以下类托入项目中 HyPopMenuViewDelegate.h HyPopMenuView.h PopMenuModel.h PopMenuButton.h UIColor+ImageGetColor.hHyPopMenuView.himport

###使用方法 实例HyPopMenuView

@property (nonatomic, strong) HyPopMenuView* menu;
_menu = [HyPopMenuView sharedPopMenuManager];

###属性以及方法说明 数据源,支持类型PopMenuModel

@property (nonatomic, retain) NSArray<PopMenuModel*>* dataSource

背景类型默认为 HyPopMenuViewBackgroundTypeLightBlur 可以改变背景类型,详情看枚举说明。

@property (nonatomic, assign) HyPopMenuViewBackgroundType backgroundType

动画类型默认为 HyPopMenuViewAnimationTypeSina 可以改变弹出动画类型类型,详情看枚举说明。

@property (nonatomic, assign) HyPopMenuViewAnimationType animationType

自动识别icon背景颜色,默认关闭。

@property (nonatomic, assign) BOOL automaticIdentificationColor;

代理,回调相关属性

@property (nonatomic, assign) id<HyPopMenuViewDelegate> delegate;

弹出动画速度,取值范围: 0.0f ~ 20.0f,默认为 10.0f。

@property (nonatomic, assign) CGFloat popMenuSpeed;

顶部自定义View

@property (nonatomic, strong) UIView* topView;

##公有方法

初始化方法

+ (instancetype)sharedPopMenuManager;

打开菜单(dataSource属性必须赋值)

- (void)openMenu;

关闭菜单

- (void)closeMenu;

是否打开菜单 yes为打开,no为关闭

- (BOOL)isOpenMenu;

##通知相关

相信我不用解释是什么意思了吧

UIKIT_EXTERN NSString* const HyPopMenuViewWillShowNotification;
UIKIT_EXTERN NSString* const HyPopMenuViewDidShowNotification;
UIKIT_EXTERN NSString* const HyPopMenuViewWillHideNotification;
UIKIT_EXTERN NSString* const HyPopMenuViewDidHideNotification;

注意事项

开源库需要Facebook开源的动画框架-Pop支持。

期待

  • 如果在使用过程中遇到BUG,希望你能Issues我
  • 如果觉得好用请Star!

hypopmenuview's People

Contributors

wwdc14yh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hypopmenuview's Issues

弹出菜单后,点击选项,发现并不是所有的都有放大的动画

HyPopMenuView.m 文件内,- (void)selectedFunc:(PopMenuButton *)sender 方法有问题

 NSLog(@"点击按钮的标题>>>>>>>>>>>>>>>>>>>>>>>>%@", sender.model.titleString);

// sender.layer.cornerRadius = CGRectGetWidth(sender.frame)/2;
// sender.backgroundColor = [UIColor redColor];
//UIWindow window = (id)[self getMainView];
__weak HyPopMenuView
weakView = self;
for (PopMenuModel obj in _dataSource) {
PopMenuModel
model = obj;
NSLog(@"遍历到的按钮>>>>>>>>>>>>%@", obj.titleString);
PopMenuButton* button = (id)model.customView;
if (sender == button) {
[sender selectdAnimation];
}else{
[button cancelAnimation];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[model performSelector:@selector(_obj)];
});
}
其中的判断方式,sender == button, 并不安全
image
sender 地址出现重复,放大效果有问题。

咨询

菜鸟一个,已经集成了您的三方库,效果很好,但是如何添加代码当点击图标时,会跳到其它页面,而不是返回

Context not created!

我在运行时会报错,<UIVisualEffectView 0x7ffda0513380> is being asked to animate its opacity. This will cause the effect to appear broken until opacity returns to 1.
Context not created!
求问什么原因...

Swift

@wwdc14 i converted this project to swift and it all works great but the top view won't appear. I tried everything and added the view as well. Could you take a look at it if I send you the swift project

IOS8.0 swift 点击menu button后 delegate没有被调用

public func popMenuView(popMenuView: HyPopMenuView!, didSelectItemAtIndex index: UInt) {
}

点击menu button之后,上面的delegate没被调用, 不知道什么问题。Debug的时候,显示下面方法里的这个if条件不满足: if ([weakView.delegate respondsToSelector:@selector(popMenuView:didSelectItemAtIndex:)])

  • (void)selectedFunc:(PopMenuButton_)sender
    {
    _weak HyPopMenuView weakView = self;
    [_dataSource enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL* _Nonnull stop) {
    PopMenuModel* model = obj;
    PopMenuButton* button = (id)model.customView;
    if (sender == button) {
    [sender selectdAnimation];
    }
    else {
    [button cancelAnimation];
    }
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    [model performSelector:@selector(_obj)];
    });
    }];
    NSUInteger idx = [_dataSource indexOfObject:sender.model];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    if (weakView.delegate) {
    if ([weakView.delegate isKindOfClass:[[weakView currentViewController] class]]) {
    if ([weakView.delegate respondsToSelector:@selector(popMenuView:didSelectItemAtIndex:)]) {
    [weakView.delegate popMenuView:weakView didSelectItemAtIndex:idx];
    }
    }
    else {
    NSLog(@"不在同一个控制器");
    }
    }
    });
    [UIView animateWithDuration:0.2 animations:^{
    weakView.bottomView.backgroundColor = [UIColor clearColor];
    weakView.disappearButton.transform = CGAffineTransformMakeRotation(0);
    [weakView.disappearButton setAlpha:0.1f];
    }];

    [UIView animateKeyframesWithDuration:0.5 delay:0.2f options:0 animations:^{
    weakView.backgroundView.alpha = 0.0;
    }
    completion:^(BOOL finished) {

        [weakView.backgroundView removeFromSuperview];
        [window setHidden:finished];
    }];
    

    }

行数计算错误

HyPopMenuView.m M327
NSUInteger toRows = (_dataSource.count / column);
Demo中有6个按钮,6/3=2行是正确的,如果只有5个按钮5/3=1结果是一行,整个位置会发生错误。
需要改为
NSUInteger toRows = (_dataSource.count / column) + ((_dataSource.count % column) ? 1 : 0);

菜单上的button出现异常

我把demo里viewController 里的代理方法里面的内容屏蔽掉,如下

  • (void)popMenuView:(HyPopMenuView*)popMenuView
    didSelectItemAtIndex:(NSUInteger)index
    {
    // UIViewController* t =
    // [self.storyboard instantiateViewControllerWithIdentifier:@"two"];
    // [self.navigationController pushViewController:t animated:false];
    }
    然后点击加号弹出菜单,点击菜单上的button,菜单消失。连续重复操作,界面就出现了下面的状况
    image
    。。图片显示不了 我描述一下吧,就是菜单上只剩下当前点的button。其他的没有了。再次点击加号后,菜单上一闪而过所有button。

这不是一个issues!

了解到你现在在找工作,我们公司也在招聘ios高级工程师,是否愿意留电话号码?

iOS11 上崩溃

点击按钮 崩溃在 HyPopMenuView.m 的 118 行

报错如下:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<popMenvTopView: 0x7fbaed70ca80; frame = (0 44; 375 92); autoresize = W+H; layer = <CALayer: 0x60400042a400>> has been added as a subview to <UIVisualEffectView: 0x7fbaed404a50; frame = (0 0; 375 667); layer = <CALayer: 0x60000003f9a0>>. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'

iOS适配问题

在iOS9下presentViewController会提示unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow: (null),希望修复一下window的使用。

导入报错

导入Pop运行都没问题,一导入HyPopMenuView那六个文件就报错,编译过不了……"OBJC_CLASS$_POPSpringAnimation", referenced from: objc-class-ref in HyPopMenuView.o

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.