Code Monkey home page Code Monkey logo

lgplusbuttonsview's People

Contributors

friend-lga avatar romanr 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

lgplusbuttonsview's Issues

Easy way to center the button?

Hi! I love how simple your library is. My issue is that I'm not using the button for a menu, but just as an appearing and disappearing floating button. I would like to have it bottom-centered, but because of the set ENUM, I can't figure out how to center it. Would this just need to have a new case for bottom center or is there something I can do without modifying the code?

Shadow rotates together with button graphics. Shadow needs to be property of LGPlusButtonsView.

Try to set Shadow offset to non-centered value on Y scale, e.g.

  UIImage *circleImageNormal = [LGDrawer drawEllipseWithImageSize:
  ....
  shadowOffset:CGPointMake(0, 2);
  shadowBlur:shadowBlur];
  [_plusButtonsView setButtonsImage:circleImageNormal forState:UIControlStateNormal];

image

When Plus button is pressed the shadow rotates 45 degrees with it:

image

Therefore button graphics shadow works only if it's perfectly centered.

Shadow needs to be property of LGPlusButtonsView, not part of button graphics.
e.g.

_plusButtonsView.shadowOffset=
_plusButtonsView.shadowColor=
_plusButtonsView.shadowBlur=

How can i add button whereever i want?

Hi,
I want to add a floating button somewhere in the view. There are only 4 options.
-LGPlusButtonsViewPositionBottomRight
-LGPlusButtonsViewPositionBottomLeft
-LGPlusButtonsViewPositionTopRight
-LGPlusButtonsViewPositionTopLeft
I need to add button at the point-for example : CGPointMake(100, 100)-.Is there any
solition for this situation.

Best Regards,
Yigit.

screen shot 2016-06-22 at 11 46 54

Do not hide on scroll if parent view content size less than viewport

There is a UX issue when your scroll view content size is smaller or equal to viewport.
For example Table view with no rows or only couple of rows. User pulls the Scroll/Table view and view bounces, scroll event fires and button disappears.
Plus button in this case must stay on screen to allow user to add items.

  • There is no need to hide Plus button since scroll view is empty and user will need to use this button anyway to add content.
  • User may not know how to get the Plus button back. They need to pull/drag the empty scroll view to make it appear. The Plus button pattern is about letting user discover the Plus button by scrolling the content and learn how to get the Plus button to display this way
  • It is then reported by user as a bug , "Cannot add new items" during the user testing.
  • And finally, take a look at Googles Inbox app, that's how it works there - the Plus button stays on screen and does not hide automatically when there's no content to scroll.

Cannot hide button atIndex with iPhone X

I try to add plus button on the bottom-right like demo code.
When I tap on plus button or any where, the buttons will be dismiss.
But on iPhone X doesn't work, just show log with index = 0.

Setting all buttons to same size produces unwanted offset

If button 0 is not larger than other buttons, unwanted offset is introduced.

How to reproduce:
Do not set larger size for buttonAtIndex:0
comment out in Demo project PlusViewController.m:84

    [_plusButtonsViewMain setButtonAtIndex:0 size:CGSizeMake(56.f, 56.f)

to

//     [_plusButtonsViewMain setButtonAtIndex:0 size:CGSizeMake(56.f, 56.f)

Result : buttons 1-3 have unwanted offset left relative to button 0:

image

Tappable area (hotspot) bigger than initial "Plus" button

Hi all, I inherited an Objective-C project which uses LGPlusButtons.
It behaves like this: there is a main button which, once tapped, reveals two sub-buttons, so user can choose between a couple of actions.

But there is one problem: The whole hotspot area is active, even where the sub-buttons will be, but before main button is tapped and these sub-buttons are visible, which makes a much bigger tappable area when that area should still be not active, leading to unwanted behavior.

I have read docs and class ref. and I can't find a property to be able to set or a way to control that behavior.

Thanks a lot for any help.

Changing the position of the LGPlusButtonView

I'm trying to implement this in my project, but when I use it with UIView the buttons paper in the topright corner his is correct but I need to display them under the toprightcorner

How can I inset or change the position of the buttons programmatically? (one way is to create a uview with size 1x1 and link it to that but that's not pretty)

I can't really access the source

When I hide the LGPlusButtonsView but still can touch the button.

I have a LGPlusButtonsView in the navigation rightBarButtonItem.

when I call the method [_plusButtonsViewNavBar hideAnimated:YES completionHandler:nil];

but touch the position of button also can actionHandler then log the title, description, index .

Then I download the sample code also have same problem ..

now I just remove the LGPlusButtonsView when I call the method [_plusButtonsViewNavBar hideAnimated:YES completionHandler:nil];

and initialize when I use them , I think this's not make sense way ><

UIVisualEffectView/UIBlurEffect for overlay

I was trying to implement blur effect for overlay, but it seems like it may require significant refactoring of initialization.

Header:

@property (assign, nonatomic) BOOL useCoverBlurEffect;
@property (assign, nonatomic) UIBlurEffectStyle coverBlurEffect;

init:

      - (instancetype)initWithNumberOfButtons:(NSUInteger)numberOfButtons
                firstButtonIsPlusButton:(BOOL)firstButtonIsPlusButton
                          showAfterInit:(BOOL)showAfterInit
                     useCoverBlurEffect:(BOOL)useCoverBlurEffect
{
    self = [super init];
    if (self)
    {

.....

_coverView = [UIView new];
        if (useCoverBlurEffect) {
            self.useCoverBlurEffect=useCoverBlurEffect;
            UIBlurEffect * effect = [UIBlurEffect effectWithStyle:_coverBlurEffect];
            _coverView = [[UIVisualEffectView alloc] initWithEffect:effect];
        }
        _coverView.backgroundColor = [UIColor clearColor];
        _coverView.userInteractionEnabled = YES;
        [self addSubview:_coverView];

this works if we pass yet another parameter to init and its gets really messy. maybe we can move inititlization of drawing to another method and call it after event moveToSuperView or something like that?

Example/demo of images in buttons

No matter what I try buttons always come up with blank face without assigned images.

[_plusButtonsView setButtonsImages:@[[UIImage imageNamed:@"add-symbol"],[UIImage imageNamed:@"calendar-1"],[UIImage imageNamed:@"calendar-1"],[UIImage imageNamed:@"calendar-1"]] forState:UIControlStateNormal];

image

Are there any special requirements about images, like they have to be particular dimensions?
Will be great if we ca have Demo to include some example with images.

change each individual image on button

how can I achieve this?

for button in plusButtonView.buttons
        {
            switch plusButtonView.descriptions
            {
            case "Current Location": button.setImage(UIImage(named: "currentLocation"), forState: UIControlState.Normal)
            case "Global":           button.setImage(UIImage(named: "global"),          forState: UIControlState.Normal)
            case "Friends":          button.setImage(UIImage(named: "friends"),         forState: UIControlState.Normal)

            default: println("something went wrong along the way");
            }
        }

this didn't do anything at all

iPhone X, XS, XR bug - Buttons overlap

A button placed in a transparent navigation bar is overlapped by the first button in the drop-down menu. This only happens with the newer iPhones (X, XS, XR) and when the navigation bar is set to be transparent.

Any thoughts on a fix?
simulator screen shot - iphone xr - 2018-10-17 at 13 41 34

Scrollable Vertical

I have a lot item for menu (more than 20), so can I scroll by vertical direction?
simulator screen shot apr 21 2016 11 58 43 am

Closing menu dynamically

It is possible to close the menu dynamically but the first button remains in "cross" state. How can I make it return "plus" state?

Button Images

How do I set the icon/image inside each button in Objective-C? Cannot seem to get it to work :(

Collapse on scroll

The button does not collapse on scroll. The opened buttons stay open. I could not find how to make them hide. Am I missing something?
If it's not built-in function, this is a significant UX problem. Nobody ever need those buttons stay open while parent view is scrolling. I think such functionality should be part of LGPlusButtons rather than coding manually hooking up to scroll event.

Collaborators WANTED

Guys, sorry, but now I totally don't have enough time to support my repositories. If somebody want to participate I will glad to add him.

And one more thing. If you really want to collaborate, prove your interesting in this library. Star it, fork it, make some issues, pull request. Show me that you understand how it works inside. Or if you do not create any pull request, but really want to improve this library, show me some your ios code and let me see your level.

Add tap on the descirption

I would like to add tap feature on the description label.
So that I can either click the button or label to trigger the function.

But as if I add the UITapGestureRecognizer on the description, it is not working

Would you mind help me have a check for the method?

- (void)setDescriptionsTap
{
    for (NSUInteger i=0; i<_descriptionsArray.count; i++)
    {
        [_descriptionsArray[i] setUserInteractionEnabled:true];
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(buttonActionForTap:)];
        tapGesture.delegate = self;
        [tapGesture.view setTag:i];
        [_descriptionsArray[i] addGestureRecognizer:tapGesture];

    }
}

Buttons offset should automatically adjust according to observed scroll view's scroll insets

When it's added to TabBar, the scrollview extends under tab bar but it's scrollbars inset is within the viewport above TabBar.

image

Scrollbar does not extend under the TabBar. Scrollable area inset is known, PlusButton is expected to appear in that inset area.

Yes, we could fix it by setting:

self.plusButtonsView.offset = CGPointMake(0.f, -50.f);

But this is merely a workaround and may be broken in the future when different device and tabBar sizes introduced.

Expected: PlusButtons adjust inset according to observed scroll views scroll insets:
image

Issue in the Demo code

Hey, I really like your project!

I experienced a bug when trying to add the demo code to my project here (the commented part):

    LGPlusButtonsView *buttonTwo;
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    buttonTwo = [LGPlusButtonsView plusButtonsViewWithNumberOfButtons:4
                                                     firstButtonIsPlusButton:YES
                                                               showAfterInit:YES
                                                               actionHandler:^(LGPlusButtonsView *plusButtonView,    NSString *title, NSString *description, NSUInteger index)
                        {
                            NSLog(@"actionHandler | title: %@, description: %@, index: %lu", title, description, (long unsigned)index);
                            
                            //if (index == 0)
                                //[buttonTwo hideAnimated:YES completionHandler:nil];
                        }];

If i uncomment the code then the plus button shows up on the bottom right but disappears once you click it.

Change the code to something like this, to add less confusion:

    LGPlusButtonsView *buttonTwo;
- (void)viewWillAppear:(BOOL)animated
{
     [super viewWillAppear:animated];

    buttonTwo = [LGPlusButtonsView plusButtonsViewWithNumberOfButtons:4
                                                     firstButtonIsPlusButton:YES
                                                               showAfterInit:YES
                                                               actionHandler:^(LGPlusButtonsView *plusButtonView, NSString *title, NSString *description, NSUInteger index)
                        {
                            //This will log the button click for the Floating Button
                            //NSLog(@"actionHandler | title: %@, description: %@, index: %lu", title, description, (long unsigned)index);
                            
                            if (index == 0){
                                //[buttonTwo hideAnimated:YES completionHandler:nil];
                            }else if (index == 1){
                                
                            }else if (index == 2){
                                
                            }else if (index == 3){
                                
                            }else if (index == 4){
                                
                            }else if (index == 5){
                                
                            }else if (index == 6){
                                
                            }
                        }];

How to add a UITextField

I want the user to enter a value into a UITextField after the + button is clicked,
I tried to implement methods that are similar to setting the setButtonsImages

I wrote the following methods in the Demo :
//in LGPlusButtonsView.m

- (void)setTextsField:(UITextField *)field forState:(UIControlState)state forOrientation:(LGPlusButtonsViewOrientation)orientation
{
    for (LGPlusButton *button in _buttonsArray)
        [button setTextField:field forState:state forOrientation:orientation];
    
    [self setNeedsLayout];
}

- (void)setTextsFields:(NSArray *)fields forState:(UIControlState)state
       forOrientation:(LGPlusButtonsViewOrientation)orientation
{
    NSAssert(_buttonsArray.count == fields.count, kLGPlusButtonsViewAssertionWarning(@"fields"));
    
    for (NSUInteger i=0; i<_buttonsArray.count; i++)
        if ([fields[i] isKindOfClass:[UITextField class]])
            [_buttonsArray[i] setTextField:fields[i] forState:state forOrientation:orientation];
    
    [self setNeedsLayout];
}

// in LGPlusButton.m

@property (strong, nonatomic) NSMutableDictionary *fieldsDictionary;
- (void)setTextField:(UITextField *)field forState:(UIControlState)state forOrientation:(LGPlusButtonsViewOrientation)orientation
{
    [_fieldsDictionary setObject:field forKey:[LGPlusButtonsViewShared stringFromState:state andOrientation:orientation]];
    
    if (orientation == LGPlusButtonsViewOrientationAll)
    {
        [_fieldsDictionary setObject:field forKey:[LGPlusButtonsViewShared stringFromState:state andOrientation:LGPlusButtonsViewOrientationPortrait]];
        [_fieldsDictionary setObject:field forKey:[LGPlusButtonsViewShared stringFromState:state andOrientation:LGPlusButtonsViewOrientationLandscape]];
    }
    
    [self setNeedsLayout];
}

this is how I used them
//in PlusScrollViewController.m

 UITextField *uit=[UITextField alloc];
    uit.text=@"Enter Mobile Number";
    uit.minimumFontSize=20;
    [_plusButtonsViewMain setTextsField:uit
                                forState:UIControlStateNormal
                          forOrientation:LGPlusButtonsViewOrientationAll];

the app runs but I don't see the label at all

can you please help me out? if it can be done in another way such as in opening up another View please provide the instructions

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.