Git Product home page Git Product logo

Comments (27)

McExco avatar McExco commented on July 19, 2024 3

@GutteApps May be it's a little to late. I had the same problem as you. And I figured out what caused the problem: you need to store cell object in array, so it can be referenced back.

- (void)addLiquidButton{
liquidCells = [[NSMutableArray alloc] init];
[liquidCells addObject:[[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@"foot_delete_icon"]]];

floatingActionButton = [[LiquidFloatingActionButton alloc] initWithFrame:CGRectMake(100, 300, 50, 50)];
floatingActionButton.dataSource = self;
floatingActionButton.delegate = self;
floatingActionButton.userInteractionEnabled = YES;
[self.view addSubview:floatingActionButton];
}

-(NSInteger)numberOfCells:(LiquidFloatingActionButton *)liquidFloatingActionButton{
    return liquidCells.count;
}

-(LiquidFloatingCell *)cellForIndex:(NSInteger)index{
    return [liquidCells objectAtIndex:index];
}

This way 'liquidFloatingActionButton' delegate will be called.

from liquidfloatingactionbutton.

GutteApps avatar GutteApps commented on July 19, 2024 1

@yoavlt I've implemented your library in objective-c and was able to display the floating button and customise a few cells. The LiquidFloatingActionButtonDataSource methods are called. However, the LiquidFloatingActionButtonDelegate method: -(void)liquidFloatingActionButton:(LiquidFloatingActionButton *)liquidFloatingActionButton didSelectItemAtIndex:(NSInteger)index;
is never called. (I've set my controller to be the floating button delegate) Any ideas why?

-(void)setFloatingButton{
LiquidFloatingActionButton *floatingActionButton = [[LiquidFloatingActionButton alloc] initWithFrame:CGRectMake(kScreenWidth-70, kScreenHeight-70, 50, 50)];
floatingActionButton.dataSource = self;
floatingActionButton.delegate = self;
[self.view addSubview:floatingActionButton];
}

#pragma mark - LiquidFloatingActionButtonDataSource
-(NSInteger)numberOfCells:(LiquidFloatingActionButton *)liquidFloatingActionButton{
return 2;
}

-(LiquidFloatingCell *)cellForIndex:(NSInteger)index{

LiquidFloatingCell *cell;

switch (index) {
    case 0:

        cell = [[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@"foot_delete_icon"]];

        break;
    case 1:

        cell = [[LiquidFloatingCell alloc]initWithIcon:[UIImage imageNamed:@"ic_mark_read"]];

        break;

    default:
        break;
}

return cell;

}

#pragma mark - LiquidFloatingActionButtonDelegate
-(void)liquidFloatingActionButton:(LiquidFloatingActionButton *)liquidFloatingActionButton didSelectItemAtIndex:(NSInteger)index{

[liquidFloatingActionButton close];

}

from liquidfloatingactionbutton.

vikdenic avatar vikdenic commented on July 19, 2024

How can this Cocoapod be used in an Objective-C project?

from liquidfloatingactionbutton.

mofodox avatar mofodox commented on July 19, 2024

@vikdenic Hey, maybe you should check this out thread from stackoverflow if you want to integrate Swift code in Objective-C 😄

I hope it helps ✌️

from liquidfloatingactionbutton.

tsambora avatar tsambora commented on July 19, 2024

Kinda hoping for it to be written in Obj-C.

from liquidfloatingactionbutton.

mofodox avatar mofodox commented on July 19, 2024

Hey @tsambora, it's easy for you to get it up and running in an Objective-C project.

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

Hey!
Im trying to implement it in my objective C project - but it naturally won't work with:
let floatingActionButton = LiquidFloatingActionButton(frame: floatingFrame)
floatingActionButton.dataSource = self
floatingActionButton.delegate = self

Any thoughts of what else i could use? Im brand new to iOS programming (but i love learning), so bear with me.

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al You need to implement with Objective-C.

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

I use #import "LiquidFloatingActionButton-Swift.h" in my view controller but i get an "undeclared type" for the let

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al I think that you should use "YourProjectName-Swift.h".

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

well this is to import the liquidfloatingactionbutton into my own project - wouldn't i then import LiquidFloatingActionButton-Swift.h into my viewcontroller of my original project? Or am i completely wrong on the syntax?

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al Do you use in Objective-C file (*.m) ? And if so, you should use Objective-C syntax.

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

Im trying that now with
LiquidFloatingActionButton *floatingActionButton = [[LiquidFloatingActionButton alloc] initWithFrame: floatingFrame];
floatingActionButton.dataSource = self;
floatingActionButton.delegate = self;

But im getting an undeclared identifier

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al Did you declare a floatingFrame variable?

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

By using the "@interface floatingFrame" right?

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al
Example is the following.

CGRect floatingFrame = CGRectMake(0, 0, 50, 50);

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

Ah okay! and that tells Xcode where to place the button?

Sorry for the questions again. I run a startup, and up until now I've been a web developer and graphic designer, as well as the CEO of the company. We are building an app, what it does is not really important, but we had it all developed by 3-4 different companies that fooled us into thinking they were able to make it happen. none of them could and it ended up costing me all my savings. So here i am trying to learn how to do it myself - you gotta start somewhere! So i appreciate you all helping me out, even though it might be some noob questions 👍

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al It's right! I appreciate you use my library! 👍

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

Awesome! I appreciate you sharing it!

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

Now im getting this:
skaermbillede 2015-10-16 kl 17 06 38

And the Button is not displayed in my app for some reason!

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al You need to add addSubview to displaying view, and implement LiquidFloatingActionButtonDataSource and LiquidFloatingActionButtonDelegate protocols.

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

So, i added the following to my viewControllers.m file:
#import "LiquidFloatingActionButton-Swift.h"

@synthesize LiquidFloatingActionButtonDelegate;
@synthesize LiquidFloatingActionButtonDataSource;

  • (void)viewDidLoad
    {
    [super viewDidLoad];
    [self.view addSubview:LiquidFloatingActionButtonDataSource];
    [self.view addSubview:LiquidFloatingActionButtonDelegate];

--and the following to my viewControllers.h file:

#import "LiquidFloatingActionButton-Swift.h"

@Property (nonatomic, strong)UIView *LiquidFloatingActionButtonDataSource;
@Property (nonatomic, strong)UIView *LiquidFloatingActionButtonDelegate;

I GET NO ERRORS! YAY
However nothing appears still - am i missing something?

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al
Reference:
https://github.com/yoavlt/LiquidFloatingActionButton/blob/master/Example/LiquidFloatingActionButton/ViewController.swift#L42

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

That is swift though? i can't implement it directly can i?

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@Big-al Let's learn protocol and UIKit basics. UITableView tutorial including UITableViewDelegate and UITableViewDataSource should help you.

from liquidfloatingactionbutton.

Big-al avatar Big-al commented on July 19, 2024

thx, will try!

from liquidfloatingactionbutton.

yoavlt avatar yoavlt commented on July 19, 2024

@GutteApps Sorry, I can't reproduce it. I can't understand its bugs.

from liquidfloatingactionbutton.

Related Issues (20)

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.