Giter VIP home page Giter VIP logo

kxmenu's People

Contributors

jcccn avatar kolyvan 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  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

kxmenu's Issues

How can I get the same default 'Theme-colors' as UIActionSheet?

I really like how the Popup-menu's are done, but I'm looking for a quick and easy way to get the same look-and-feel as the default UIActionSheet, that is: a white-backgroundcolor and black textColor.

Can you give some hints where I should make the changes, or perhaps make some methods with which I can easily adopt the iOS standard look-and-feel color-scheme regarding UIActionSheet?

Thanks in advance!

I already found the solution e.g.:

  1. To get the white backgroundcolor change in KxMenu.m KxMenuView the following method:

define USE_UIACTION_COLORS 1

  • (void)drawBackground:(CGRect)frame
    inContext:(CGContextRef) context
    {
    #if defined(USE_UIACTION_COLORS) && (USE_UIACTION_COLORS == 0)
    CGFloat R0 = 0.267, G0 = 0.303, B0 = 0.335;
    CGFloat R1 = 0.040, G1 = 0.040, B1 = 0.040;
    #else
    CGFloat R0 = 1.0, G0 = 1.0, B0 = 1.0;
    CGFloat R1 = 0.961, G1 = 0.961, B1 = 0.961;
    #endif

and to get the blueish button colors change in the mkContentView:

  1. Using the same defined macro above:
    #if defined(USE_UIACTION_COLORS) && (USE_UIACTION_COLORS == 0)
    titleLabel.textColor = menuItem.foreColor ? menuItem.foreColor : [UIColor whiteColor];
    #else
    UIColor *textColor = [UIColor colorWithRed:0/255.0f green:118/255.0f blue:225/255.0f alpha:1.0];
    titleLabel.textColor = menuItem.foreColor ? menuItem.foreColor : textColor;
    #endif

Use Gesture Recognizer to dismiss menu

If Gesture Recognizer is enabled in the superview, the touchesEnded event will not be fired in KxMenuOverlay.

As a quick fix, add a gesture recognizer in KxMenuOverlay:

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.opaque = YES;

        UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
        [self addGestureRecognizer:singleFingerTap];
    }
    return self;
}

- (void)singleTap:(UITapGestureRecognizer *)recognizer
{
    for (UIView *v in self.subviews) {
        if ([v isKindOfClass:[KxMenuView class]] && [v respondsToSelector:@selector(dismissMenu:)]) {
            [v performSelector:@selector(dismissMenu:) withObject:@(YES)];
        }
    }
}

Delegate for when the menu is dismissed

I want to be able to do something in my implementation when the menu is dismissed. In my particular scenario, I'm changing the background color of a row when the button to display the menu is clicked and reverting the color when the menu is dismissed by tapping anywhere (seems to be the 'SingleTap' event). It's possible that this functionality is already available and maybe I'm missing something so let me know.

More menu items can fit screen

Let's say if more menu items can fit with one screen - consider to make it scrollable?

Currently, it'll show the last several items which can fit one screen

Can not set item height

It's very useful if you add a property to set items height not only calculated with font size. Cheers!

Not positioning correctly in UIScrollView when using negative contentOffset (e.g. pull-to-refresh)

Here
https://github.com/kolyvan/kxmenu/blob/master/Source/KxMenu.m#L323
KxMenuOverlay *overlay = [[KxMenuOverlay alloc] initWithFrame:view.bounds];

view.bounds has y negative during pull-to-refresh and therefore the menu is shown the height of the pull-to-refresh area too high. Its correct in that way that it covers the whole screen with the overlay so you can click everywhere to dismiss, but the actual menu will be displaced.

The solution if you don't care that the pull-to-refresh area will not be part of the dismiss area is this instead:

``KxMenuOverlay *overlay = [[KxMenuOverlay alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)];`

Or if you want the whole area to be dismiss area you can adjust the supplied rect for contentOffset (here: https://github.com/kolyvan/kxmenu/blob/master/Source/KxMenu.m#L316):

if([view isKindOfClass:[UIScrollView class]]) rect = CGRectMake(rect.origin.x, rect.origin.y-((UIScrollView*)view).contentOffset.y, rect.size.width, rect.size.height);

Can not set max width to KxMenuItem

Maybe I have missed this, but it seems that I can not set max width for KxMenuItem. If my menu item text is too wide, then it will extend out of the screen. Is there better solution than manually manipulate the text set into the title property?

Thanks.

The header file for iOS should be UIKit/UIKit.h

When I built it for iOS 8 in the Xcode 7, it will report some errors. After checking, the header file has been wrong. The Foundation is the kit for Mac OS X, but not for iOS. So the header file importing of KxMenu.h should be UIKit/UIKit.h.
#import <UIKit/UIKit.h>
And there is some warnings for iOS 7 and later. The first is [menuItem.title sizeWithFont:[UIFont systemFount]] in -mkContentView. It can be used as const CGSize titleSize = [menuItem.title sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}];
The second is a dismissMenu warning. It can add a declaration in the KxMenuView like this @interface KxMenuView : UIView -(void) dismissMenu:(BOOL)animated; @end to avoid this kind of building warning.

undeclared selector 'dismissMenu:'

2 'dismissMenu' selector issues.

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    UIView *touched = [[touches anyObject] view];
    if (touched == self) {

    for (UIView *v in self.subviews) {
        if ([v isKindOfClass:[KxMenuView class]]
            && [v respondsToSelector:@selector(dismissMenu:)]) {

            [v performSelector:@selector(dismissMenu:) withObject:@(YES)];
        }
    }
}
}

OSX port

Thanks for your excellent control.Are you planning to develop an OSX version?

Thanks and regards,

Fix for compiler warning on OSX-10.9.5 with Xcode-6.1.1

Great project by the way!

On OSX-Maverick with Xcode-6.1.1 I get the following compiler warning in KxMenu.m:
"Undeclared selector 'dismissMenu:'"

this can be fixed by adding the forward definition dismissMenu on line 48 in KxMenu.m:

@interface KxMenuView : UIView
- (void)dismissMenu:(BOOL) animated;
@end

Determine if menu is currently visible

Instead of having the menu flash hidden / shown if the menu is already on screen it would be nice to have an isVisible property / method so I can skip reshowing the already visible menu.

I tried doing a simple bit of code checking for _menuView != nil but since that is not set back to nil when the user clicks somewhere off the menu to cancel it this does not work.

Menu needs to track / be notified of being clicked off of so it can do _menuView = nil when that happens.

Do a tag for cocoapods

Glad to find your repo.
Could you do a git tag, so I can make a cocoapods spec.(github.com/CocoaPods/Specs)
Thank you!

Can't figure the menu bar's width.

Check this out:

MenuA: imageA @"stringA".
MenuB: no image @"largeStringB_asdfasdfasdf"

Result: the MenuB's width have not added the image's width. It shows "largeStringB_as..."

Expert Result: the MenuB's width have added the image's width. It shows "largeStringB_asdfasdfasdf"

Images are blurred when presenting the view controller

Hi,
The images used in KxMenuItem are shown as blurred ones when the view is presented (presentViewController:). But the same images are displayed properly when the view is pushed (pushViewController:). Why is it so?

hello

the items view why not use UIScrollView

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.