Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法在同一个页面同时显示多个弹出菜单? #11

Open
Haley-Wong opened this issue Nov 16, 2016 · 12 comments
Open

无法在同一个页面同时显示多个弹出菜单? #11

Haley-Wong opened this issue Nov 16, 2016 · 12 comments

Comments

@Haley-Wong
Copy link

看了一下,里面关于菜单的配置使用的是一个单例的configuration,显示菜单也是使用的单例menu。
建议考虑添加相互独立的menu菜单。可以保证在同一个页面弹出多个不同的菜单,而不同的菜单还可以有不同的样式(主要体现在背景色、文字颜色、宽度、高度等)。

@liufengting
Copy link
Owner

我开个分支

@liufengting
Copy link
Owner

想了一下,好像架构完全不一样了,这个需求是否完全必要,或者截至时限有多久?我在考虑重新写。

@Haley-Wong
Copy link
Author

我本来也想改你源码来着,看了一下目前里面的架构只能支撑单个弹窗,没法改,就先用单弹窗做了考虑以后撸,不急。
另外,我发现如果弹窗箭头是朝下的话,背景是类似白色的浅色,最后一个分割线很碍眼。如下图:
f1ce771e-bf4d-4964-b082-4dd836348ced

然后我考虑在判断到方向后,tableView上添加一个视图覆盖掉最后那个分割线,代码如下(196行):

if (_arrowDirection == FTPopOverMenuArrowDirectionDown) {
        menuRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height - FTDefaultMenuArrowHeight);
        // 遮住最后的白线 by Haley 2016-11-17
        UIView *lineView = [self viewWithTag:201];
        if (!lineView) {
            lineView = [[UIView alloc] initWithFrame:CGRectZero];
        }
        lineView.frame = CGRectMake(5, menuRect.size.height-2, menuRect.size.width - 10, 2);
        lineView.tag = 201;
        lineView.backgroundColor = [FTPopOverMenuConfiguration defaultConfiguration].tintColor;
        [self insertSubview:lineView aboveSubview:self.menuTableView];
    }
    [self.menuTableView setFrame:menuRect];
    [self.menuTableView reloadData];

其实就算是朝上的,也可以遮住最后的分割线。关于遮盖分割线的视图宽高位置,以及用tag还是属性view,还有必要性,你考虑一下。最后的效果是这样的:
141f8e95-5951-4b45-a421-07f97ccdf854

@Haley-Wong
Copy link
Author

我这边是要实现微信公众号底部菜单的效果。

@liufengting
Copy link
Owner

试试这几行代码:

if (indexPath.row == _menuStringArray.count-1) {
menuCell.separatorInset = UIEdgeInsetsMake(0, self.bounds.size.width, 0, 0);
}else{
menuCell.separatorInset = UIEdgeInsetsMake(0, FTDefaultMenuTextMargin, 0, FTDefaultMenuTextMargin);
}

@liufengting
Copy link
Owner

这个更改已经发布了1.2.3版本

@Haley-Wong
Copy link
Author

你这个处理效果更优!

@Haley-Wong
Copy link
Author

分割线左边距并不是设置的宏的值6,不知道你这边有更优雅的做法么?我是把后面改成了10+宏值。

@liufengting
Copy link
Owner

后来提交的代码里面其实是可以随意设置的,可能170行左右这行代码需要注释掉:

    _menuTableView.separatorInset = UIEdgeInsetsMake(0, FTDefaultMenuTextMargin, 0, FTDefaultMenuTextMargin);

111
1111

@Haley-Wong
Copy link
Author

@liufengting 测试了10月14号我下载的版本,和刚下的版本,得出的结果是在iOS 10以上分割线正常,在iOS 10以下(测了iOS 9),分割线前面有固定15的距离。

@liufengting
Copy link
Owner

那应该是系统的限制吧,这个不太好解决,我去查查看吧。

@liufengting
Copy link
Owner

刚才看到一个帖子希望有些帮助,我还没有测试过,你也试试看吧希望能解决iOS9上的这个问题。

http://stackoverflow.com/questions/31537196/ios-9-uitableview-separators-insets-significant-left-margin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants