Comments (27)
@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.
@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.
How can this Cocoapod be used in an Objective-C project?
from liquidfloatingactionbutton.
@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.
Kinda hoping for it to be written in Obj-C.
from liquidfloatingactionbutton.
Hey @tsambora, it's easy for you to get it up and running in an Objective-C project.
from liquidfloatingactionbutton.
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.
@Big-al You need to implement with Objective-C.
from liquidfloatingactionbutton.
I use #import "LiquidFloatingActionButton-Swift.h" in my view controller but i get an "undeclared type" for the let
from liquidfloatingactionbutton.
@Big-al I think that you should use "YourProjectName-Swift.h".
from liquidfloatingactionbutton.
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.
@Big-al Do you use in Objective-C file (*.m) ? And if so, you should use Objective-C syntax.
from liquidfloatingactionbutton.
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.
@Big-al Did you declare a floatingFrame
variable?
from liquidfloatingactionbutton.
By using the "@interface floatingFrame" right?
from liquidfloatingactionbutton.
@Big-al
Example is the following.
CGRect floatingFrame = CGRectMake(0, 0, 50, 50);
from liquidfloatingactionbutton.
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.
@Big-al It's right! I appreciate you use my library! 👍
from liquidfloatingactionbutton.
Awesome! I appreciate you sharing it!
from liquidfloatingactionbutton.
And the Button is not displayed in my app for some reason!
from liquidfloatingactionbutton.
@Big-al You need to add addSubview
to displaying view, and implement LiquidFloatingActionButtonDataSource
and LiquidFloatingActionButtonDelegate
protocols.
from liquidfloatingactionbutton.
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.
@Big-al
Reference:
https://github.com/yoavlt/LiquidFloatingActionButton/blob/master/Example/LiquidFloatingActionButton/ViewController.swift#L42
from liquidfloatingactionbutton.
That is swift though? i can't implement it directly can i?
from liquidfloatingactionbutton.
@Big-al Let's learn protocol
and UIKit
basics. UITableView tutorial including UITableViewDelegate
and UITableViewDataSource
should help you.
from liquidfloatingactionbutton.
thx, will try!
from liquidfloatingactionbutton.
@GutteApps Sorry, I can't reproduce it. I can't understand its bugs.
from liquidfloatingactionbutton.
Related Issues (20)
- installation use Carthage HOT 4
- How can I change openDuration in CircleLiquidBaseView?
- Breaks with some button colors
- Maintained? HOT 1
- How to change the cell color alone ? HOT 1
- multiple LFABs on screen
- Carthage for LiquidFloatingActionButton is not supporting
- Swift 4? HOT 1
- I want picture 1 to be as big as picture 2. Where should I change it? Thank you
- Showing Recent Messages :-1: Value for SWIFT_VERSION cannot be empty. (in target 'LiquidFloatingActionButton')
- How to use didTapped and didLongTapped
- Can swift 5 be updated? HOT 2
- Not updated for pod install HOT 1
- Accessibility Problems
- Doesn't support Objective C
- Is the 2.0.0 version available in cocoapods? HOT 1
- is this pod available for swift 2.2 ??
- Update to Swift 3 description HOT 1
- No shared framework issue HOT 6
- delete this
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liquidfloatingactionbutton.