Code Monkey home page Code Monkey logo

dcpathbutton's People

Contributors

alexjeng avatar ianhirschfeld avatar kevnm67 avatar peng90 avatar skyline75489 avatar tangdixi avatar tdubik avatar thundertrick 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

dcpathbutton's Issues

TabbarControler + DCPathButton

Hello,

I try to integrate the DCPathButton into a tabbbar of a tabbarcontroller.
There is always something hidden (DCPathButton or tabbar).

I can do it with a viewvontroller and one extra tabbar, but then I have to copy the tabbar and all the segues to every involved view controller. The code turns into chaos...

How could I fit that?

SWIFT Code

Hello,

Do you have the swift code version of the same?

Cheers,
thecrazy

Strange Error regarding the protocol

import UIKit

class TabController: UITabBarController, DCPathButtonDelegate{

override func viewDidLoad() {
    super.viewDidLoad()
    configureDCButton()

    let testObject = PFObject(className: "TestObject")
    testObject["foo"] = "bar"
    testObject.saveInBackgroundWithBlock { (success: Bool, error: NSError?) -> Void in
        println("Object has been saved.")
    }

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}


func configureDCButton() {

    // Configure center button
    //
    var dcPathButton: DCPathButton =  DCPathButton(centerImage: UIImage(named: "chooser-button-tab"), highlightedImage: UIImage(named: "chooser-button-tab-highlighted"))

    dcPathButton.delegate = self

    // Configure item buttons
    //

    var itemButton_0: DCPathItemButton = DCPathItemButton(image: UIImage(named: "drink"), highlightedImage:  UIImage(named: "drink"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_1: DCPathItemButton = DCPathItemButton(image: UIImage(named: "food"), highlightedImage: UIImage(named: "food"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_2: DCPathItemButton = DCPathItemButton(image: UIImage(named: "weight"), highlightedImage:  UIImage(named: "weight"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_3: DCPathItemButton = DCPathItemButton(image: UIImage(named: "fitness"), highlightedImage:  UIImage(named: "fitness"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_4: DCPathItemButton = DCPathItemButton(image: UIImage(named: "love"), highlightedImage:  UIImage(named: "love"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_5: DCPathItemButton = DCPathItemButton(image: UIImage(named: "time"), highlightedImage:  UIImage(named: "time"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    // Add the item button into the center button
    //
    dcPathButton.addPathItems([itemButton_0, itemButton_1, itemButton_2, itemButton_3, itemButton_4, itemButton_5])
    // Change the bloom radius
    dcPathButton.bloomRadius = 120.0
    // Change the DCButton's center
    dcPathButton.dcButtonCenter = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height - 35.5)
    self.view.addSubview(dcPathButton)
}

func itemButtonTappedAtIndex(index: UInt) {
    println("You tap at index : \(index)")
}

}

Error 1: Type 'TabController' does not conform to protocol 'DCPathButtonDelegat'
Error 2: dcPathButton.delegate = self => Cannot assign a value of type 'TabControler' to a value of type 'DCPathButtonDelegate!'

This is the method of the example project:

  • (void)itemButtonTappedAtIndex:(NSUInteger)index
    {
    NSLog(@"You tap at index : %zd", index);
    }

How can I fix it?

Regarding with commit d723afdcd

From d723afd, the author does some enhancement on DCPathButton, however, all the working are done in Examples folder, could you fix it and update cocoapods accordingly?

Delegate Improvements

The delegates willDismissDCPathButtonItems: and didDismissDCPathButtonItems: are not fired unless you tap on the center button to dismiss. I would think they also get fired when tapping on one of the button items.

Currently there is no way to trigger an action after the dismiss animation, because pathButton:clickItemButtonAtIndex: happens on tap.

As an improvement, I suggest either:

  1. All 3 of these delegates should fire in the right sequence.
  2. Add a new delegate to fire after the dismiss animation for selecting an item button index.

How to increase touch area for DCPathButton?

How to increase touch area for DCPathButton?

See the below image

screen shot 2015-09-09 at 2 52 46 pm

I'm able to implement DCPathButton in my app, thanks !! But I'm only able to show menu if my user taps on ( + ) button [see image]. Is there a way to increase touch area?

I tried, with this code that increase the area but I'm only able to touch ( + ) area.

Swift 2.0 Version

Hi
Awesome work....

I am just wondering when you will be releasing the Swift 2.0 version.?

Thanks

Menu Disappears After First Click

I have attached a movie to show, but essentially everything sets up and looks great. There are currently two problems I have:

  1. The items do not fire any events
  2. After the first click the menu dissappears.
    func setupDC(){
        var img = UIImage(named: "box")
        var pathButton = DCPathButton(centerImage: img, hilightedImage: img)
        //pathButton.bloomRadius = 150.0
        var pathHeight = pathButton.frame.height
        var pathWidth = pathButton.frame.width
        var pathButtonX = self.view.frame.width / 2 - pathWidth/2
        var pathButtonY = CGRectGetMaxY(self.view.frame) - pathHeight


        self.view.addSubview(pathButton)

        var buttitem1 = DCPathItemButton(image: img, highlightedImage: img, backgroundImage: img, backgroundHighlightedImage: img)
        var buttitem2 = DCPathItemButton(image: img, highlightedImage: img, backgroundImage: img, backgroundHighlightedImage: img)
        var buttitem3 = DCPathItemButton(image: img, highlightedImage: img, backgroundImage: img, backgroundHighlightedImage: img)

        pathButton.center = CGPointMake(pathButtonX, pathButtonY)

        pathButton.frame = CGRectMake(pathButtonX, pathButtonY, pathWidth, pathHeight)
        pathButton.addPathItems([buttitem1, buttitem2, buttitem3])

    }

Issue using lib in Swift project - please help.

Hi there! Great work! However, I keep running into an issue when I use your lib in my swift project. I was hoping you can help?

__ERROR
/.../FoodStoryVC.swift:11:1: Type 'FStoryVC' does not conform to protocol 'DCPathButtonDelegate'

__ HEADER of my Swift file
import UIKit
class FStoryVC: UIViewController, UITableViewDelegate, UITextFieldDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextInputTraits, UIActionSheetDelegate, DCPathButtonDelegate { ...

__ IMPLEMENTATION
// MARK: Delegate
func itemButtonTappedAtIndex(index: Int)
{
println("You tap at index : (index)")
}

override func preferredStatusBarStyle()->(UIStatusBarStyle)
{
    return UIStatusBarStyle.LightContent
}

// MARK: Buttons
func ConfigureDCPathButton() {

    // Configure center button
    //
    var dcPathButton: DCPathButton =  DCPathButton(centerImage: UIImage(named: "chooser-button-tab"), hilightedImage: UIImage(named: "hooser-button-tab-highlighted"))
    dcPathButton.delegate = self

    // Configure item buttons
    //
    var itemButton_1: DCPathItemButton = DCPathItemButton(image: UIImage(named: "chooser-moment-icon-music"), highlightedImage: UIImage(named: "chooser-moment-icon-music-highlighted"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_2: DCPathItemButton = DCPathItemButton(image: UIImage(named: "chooser-moment-icon-place"), highlightedImage:  UIImage(named: "chooser-moment-icon-place-highlighted"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_3: DCPathItemButton = DCPathItemButton(image: UIImage(named: "chooser-moment-icon-camera"), highlightedImage:  UIImage(named: "chooser-moment-icon-camera-highlighted"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_4: DCPathItemButton = DCPathItemButton(image: UIImage(named: "chooser-moment-icon-thought"), highlightedImage:  UIImage(named: "chooser-moment-icon-thought-highlighted"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    var itemButton_5: DCPathItemButton = DCPathItemButton(image: UIImage(named: "chooser-moment-icon-sleep"), highlightedImage:  UIImage(named: "chooser-moment-icon-sleep-highlighted"), backgroundImage: UIImage(named: "chooser-moment-button"), backgroundHighlightedImage: UIImage(named: "chooser-moment-button-highlighted"))

    // Add the item button into the center button
    //
    dcPathButton.addPathItems([itemButton_1, itemButton_2, itemButton_3, itemButton_4, itemButton_5])

    // Change the bloom radius
    dcPathButton.bloomRadius = 120.0

    // Change the DCButton's center
    dcPathButton.dcButtonCenter = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height - 25.5)

    self.view.addSubview(dcPathButton)

}

Inside a ViewController

Is there a way to instantiate this from within a view controller?.

When I put it in mine It seems the alignment is way off or there is another view interfering... see the two screen shots below.. the dark overlay is the issue.

My setup is as follows:

  • ViewController
    • View
      • InsideView (This is the white box where i want to show the control)

before

after

Disable Rotation of Icons

I've found the rotation of the icons a little distracting on tap.

I was wondering if you could add a configuration option to disable rotation.

get DCPathItemButton position

Hi,
I have a controller that implements DCPathButtonDelegate.
The number of DCPathItemButtons in it is dynamically changes.
I need to know one of the button's position (center \ origin).
Is there any getPosition method for the DCPathItemButton?
Thanks!

Why center button is disappeared after touch again

Here is my code :
DCPathButton *centerButton = [[DCPathButton alloc] initWithCenterImage:[UIImage imageNamed:@"dot_off"] hilightedImage:[UIImage imageNamed:@"dot_off"]];

DCPathItemButton *cameraButton = [[DCPathItemButton alloc] initWithImage:[UIImage imageNamed:@"dot_on"]];

DCPathItemButton *importButton = [[DCPathItemButton alloc] initWithImage:[UIImage imageNamed:@"dot_off"]];

[centerButton addPathItems:@[cameraButton, importButton]];

[self.view addSubview:centerButton];

It shows perfectly but when I tap a button, it even dont jump to delegate function (by breakpoint & nslog)

issues of Push

When push ViewControllers,how to hide or hide with tabbarcontroller together,such as "VC.hidesBottomBarWhenPushed = YES;"

Swift 3 version?

Will there be a swift 3 version of this? Love this but when I upgraded to swift 3 it broke. :(

Example-Swift fails due to error in bridging header

Example-Swift build fails with error <unknown>:0: error: bridging header '/Users/Tangdixi/Desktop/Example-Swift/Example-Swift-Bridging-Header.h' does not exist

I'm relatively new to swift and can't figure out what could be the problem.

点击+号按钮“开屏”后,再点击背景可能无法收回来

  1. 在模拟器上,开屏后再点击第一个TabBarItem靠左侧区域变暗背景,收不回来,iOS8,9都会出现该现象
  2. 并且在我的6s真机上测试,开屏后,点击+号左侧任意的TabBarItem都必定无法收回DCPathButtonItems,而点击左侧的空白背景区域则有一定概率收不回。

以上是我的粗略测试。

Button titles?

Would it be possible to add titles above/below/around the buttons please? :)

Customize BottomView background color

Thanks for this great plugin, this saved a lot of time to setup.

Could you add a property to customize the background color of the bottomView? I see the bottomview is a private property, i have no luck to change it.

Do you recommend

  1. simply move bottom view to public? or
  2. support new property to customize background color of bottom view?

thanks.

Menu button disappears on device rotation

I wanted to test this out and just ran the example swift app and it ran in simulator on iPhone 6s in Xcode 7 / IOS 9 on El Capitan. When I rotate the simulator, however, the menu button disappears at anything other than portrait. Expect menu to still work on different orientations/sizes.

simulator screen shot oct 19 2015 8 13 14 pm

UIToolBar

So I decided to put the control into a UIToolBar. Everything seems to be as expected, but I get a really strange frame when I click the DCPathButton (currently in the centre of the view below)

Here is the code:

    func createToolBar(){
        var img = UIImage(named: "box")
        bar.frame = CGRectMake(0, self.view.frame.height-60, self.view.frame.size.width, 60)
        bar.backgroundColor = UIColor.blueColor()
        var endspace = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FixedSpace, target: nil, action: nil)
        endspace.width = 10
        var flexspace = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FlexibleSpace, target: nil, action: nil)
        var leftitem = UIBarButtonItem(image: img, style: UIBarButtonItemStyle.Plain, target: self, action: "mainMenu")
        var rightitem = UIBarButtonItem(image: img, style: UIBarButtonItemStyle.Plain, target: self, action: "mainMenu")
        //Get the view for DCPathButton
        var pathView = pathMenu()
        var centeritem = UIBarButtonItem(customView: pathView)
        bar.setItems([endspace,leftitem,flexspace, centeritem, flexspace,rightitem, endspace], animated: true)
        self.view.addSubview(bar)

    }

    func pathMenu()->DCPathButton{
        var pathButton = DCPathButton()
        var img = UIImage(named: "box")
        pathButton = DCPathButton(centerImage: img, hilightedImage: img)

        var buttitem1 = DCPathItemButton(image: img, highlightedImage: img, backgroundImage: img, backgroundHighlightedImage: img)
        var buttitem2 = DCPathItemButton(image: img, highlightedImage: img, backgroundImage: img, backgroundHighlightedImage: img)
        var buttitem3 = DCPathItemButton(image: img, highlightedImage: img, backgroundImage: img, backgroundHighlightedImage: img)

        pathButton.addPathItems([buttitem1, buttitem2, buttitem3])
        pathButton.delegate = self
        return pathButton
    }

screen shot 2014-11-19 at 10 21 50 am

Navbar + DCPathButton

Hi there, awesome code! Quick problem, when it is used with Storyboard + UINavbar , when button is tabbed the Modal overlay is not covering the NavBar.. Autolayout issues?

Adjust Speed of Menu Open

For my use case this menu is going to be used regularly by power users.

As a result I'd like to speed up the animation of the menu open / close.

Hide Button when one item on tab has pushed

Could you help me the situation that one of tab in tabbar has pushed and hide the tabbar but the DCButton still there (because it added on the tabbar controller)? Do I have a solution that add the view into tabbar so when the tabbar hides, the dcbutton will hide?

Thanks in advance!

Not Working

I am using this control as described. but its not working. As fas as design concerns, its working but when i click on any buttonItem, it doesnot call its delegate. i am using btn.delegate = self. and adding the delegate and delegate actions as well.... plzzzz help me.

Adding DCPathButton on Tab Bar

Hi,

I really loved this library! But I kinda stuck on this particular issue, I want to add this button on a tab bar instead on view (as in example) but If i had it on the Tab Bar , the DCPathItemButton seems to be unclickable, any solution to these?

CGFloat heightDifference = buttonImage.size.height - self.tabBar.frame.size.height;

CGPoint center = self.tabBar.center;
center.y = center.y - self.tabBar.frame.origin.y - heightDifference/2.0 - 8;
button.dcButtonCenter = center;

// Setting the DCButton appearance
button.allowSounds = YES;
button.allowCenterButtonRotation = NO;

button.bottomViewColor = [UIColor grayColor];
button.bloomDirection = kDCPathButtonBloomDirectionTop;
[self.tabBar addSubview:button]; 

DCPathButton breaks on hidesBottomBarWhenPushed=true

Hi Tangdixi,

I really love your work on DCPathButton! However, there is a small issue: when I set hidesBottomBarWhenPushed=true before push a UIViewController to a UINavigationController, the tabBar is hidden, but DCPathButton still shows up there. Is there anyway to hide DCPathButton when hidesBottomBarWhenPushed=true?

I have set up a sample project in https://www.dropbox.com/sh/9kfbh3i0pxm3yoz/AABb-2arK7WeChkm9e8SJtY7a?dl=0. In the controller, if you click the "click me" button, the tabBar will be hide except the DCPathButton. If we pop the view, then DCPathButton disappear in the tabBar.

Thanks!

Wrong frame with iOS8 Auto layout

Hi,
I'm trying to use this control in my app but I'm facin some issues 👍

  1. I tried to put the button in my view controller above a mapView, positioned with autolayout constraints
    Result : the button is not clickable

  2. I tried to put the button in a view above the mapView, I appear to be a the right place if I set it's frame to, say CGRectMake(0,0,35,35).
    Result : the button is clickable but once expanded, the items are not clickable. Moreover the button goes far away from it's superview just after selecting the center button to cancel action.

Do you have any clue on how to use it properly in a storyboard app using auto layout ?

Thanks for your work anyway.

delegate not called

Hi
i used your button in GMSMapview not in tap bar and delegate method - (void)itemButtonTappedAtIndex:(NSUInteger)index not called in touch event on DCPathButtonItem occurred. when debuted the code only method - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event of DCPathbutton called.
so what do you think?

Animated menu with image and title together

Can you support button with images and text together? Currently its working good without text (title) but what if I want to show a title too. I dig into your code and have no luck to achieve this on my self.

What you think?

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.