Comments (27)
Have you added the button on Table View or on a cell?
from liquidfloatingactionbutton.
@jasvindersingh-evon I set in the tableView, not in the cell. If it's in the cell, the button will located in the tableView cell, but this is not right?
let floatingFrame = CGRect(x: self.view.frame.width - 56 - 16, y: self.view.frame.height - 56 - 80, width: 56, height: 56)
let bottomRightButton = createFloatButton(floatingFrame, .Up)
self.view.addSubview(bottomRightButton)
This is my code for locating in the tableView. I've added the subView into the tableView. just wondering why it's not stick to the position, it will moves when I'm scrolling.
from liquidfloatingactionbutton.
@jefferyleo If you want to stick to the position, you should use UIWindow or other.
from liquidfloatingactionbutton.
@yoavlt Any example of UIWindow to make this button stick at the fixed position?
from liquidfloatingactionbutton.
@jefferyleo Otherwise, you can also do hierarchy views as follows.
UIView
-- LiquidFloatingActionButton
-- UITableView
from liquidfloatingactionbutton.
@yoavlt I'm sorry for telling you that I'm still a beginner in iOS programming, could you give me some clue regarding the similar code to me?
from liquidfloatingactionbutton.
@jefferyleo OK. This is example!!
https://gist.github.com/yoavlt/393a0bce0536e926b01d
from liquidfloatingactionbutton.
@yoavlt Thanks dude, I'm appreciate, I will try to do it now see whether I got it or not
from liquidfloatingactionbutton.
@yoavlt May I know what this line of code means?
tableView.snp_makeConstraints { make in
make.width.height.top.left.equalTo(self.view)
}
As I know, tableView don't have a function called snp_makeConstraints
from liquidfloatingactionbutton.
@jefferyleo It's SnapKit's extension. You can also use AutoLayout.
from liquidfloatingactionbutton.
Opps, I knew that, it's SnapKit extension hahaha I just found out that. Thank you
from liquidfloatingactionbutton.
@yoavlt I failed to do it.
make.width.height.top.left.equalTo(self.view)
There's an error on this line.
fatal error: unexpectedly found nil while unwrapping an Optional value
I've no idea why there's an optional value at this line, that's quite weird.
from liquidfloatingactionbutton.
@jefferyleo It's totally odd.
from liquidfloatingactionbutton.
@yoavlt I got a clue from this Question.
http://stackoverflow.com/questions/13663230/ios-add-subview-with-a-fix-position-on-screen
We can try to do it by this way. Let's try.
from liquidfloatingactionbutton.
@yoavlt Are you manage to do it with the scrollViewDidScroll method?
from liquidfloatingactionbutton.
@jefferyleo No, I didn't. It works for my environment.
from liquidfloatingactionbutton.
@jefferyleo: self.view is your tableview I guess, And adding it on self.view means you are adding it on tableview. So whenever the UITableView will scroll, the button will scroll with it. If you want to add it. Add it on self.view considering self.view should not be a TableView. Please attach the XIB/storyboard screenshot with outline hierarchy displayed.
from liquidfloatingactionbutton.
@jasvindersingh-evon then do you know how do I stick to the scrollView, since the scrollView has also a delegate from the tableViewController.
from liquidfloatingactionbutton.
@jefferyleo I know. You should use UIViewController instead of UITableViewController.
from liquidfloatingactionbutton.
@yoavlt But..I want to list all the news in a tableView instead of ViewController, that's why I have to use UITableViewController in necessary. :(
from liquidfloatingactionbutton.
Understood. Do one thing. Delete the UITableViewController and take a new UIViewController. In that View controller add a UITableView. Then add the button on that view controller. Set Delegate and data source of UITableView to File's Owner. And everything will work. Let me know if this doesn't works for you.
from liquidfloatingactionbutton.
@jefferyleo I agree with @jasvindersingh-evon's solution.
from liquidfloatingactionbutton.
@jasvindersingh-evon Okay, I'll try that later, will get back to you soon, I fixing another problem first. :(
from liquidfloatingactionbutton.
@yoavlt @jasvindersingh-evon Okay, good news here! I did it hahaha Thanks a lot dude, appreciated. 👍
from liquidfloatingactionbutton.
@jefferyleo Congrats!
from liquidfloatingactionbutton.
@jefferyleo How you reorder these cell ?
from liquidfloatingactionbutton.
//below implementation is for adding floating button while subclassing UITableViewController
var addMoreImageBtn : UIButton?
override func viewDidLoad() {
super.viewDidLoad()
addMoreImageBtn = UIButton(type: .Custom)
addMoreImageBtn?.setImage(UIImage(named: "Add.png"), forState: .Normal)
addMoreImageBtn?.frame = CGRectMake(0, self.view.bounds.size.height - 100, 55, 55)
addMoreImageBtn?.center = CGPointMake(self.view.bounds.width - 100 , self.view.bounds.size.height - 100)
addMoreImageBtn?.addTarget(self, action: "addButtonPressed:", forControlEvents: .TouchUpInside)
self.view.addSubview(addMoreImageBtn!)
}
override func scrollViewDidScroll(scrollView: UIScrollView) {
addMoreImageBtn?.frame.origin.y = self.view.bounds.size.height - 100 + scrollView.contentOffset.y
self.view.addSubview(addMoreImageBtn!)
self.view.bringSubviewToFront(addMoreImageBtn!)
}
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.