问题
I need to add floating button on top of UITableViewController.
The following link is used for adding FloatingButton action on top of UIViewController
Creating a floating menu in an iOS application
I already tried to add this floating button to my UITableViewController but it is not visible.
please help me thank you inadvance
回答1:
- First add the UITableView and then the Button. So it should be like this in the XIB Structure (Button is after the Table not before otherwise it will be hidden):
- Set the Button Constraints related to the Super View and not related to UITableView.
See that button constraints are related to superview. This is important if you want the Floating Button.
If everything is done correctly it would show like this:
回答2:
Floating Action button on IOS can be created with way more easier way:
- Take a button from object library and place it where ever you want it to be placed.
- Give its height and width 48x48.
Connect your button to your class and set its corner raidius to 25
yourButton.layer.cornerRadius = 25
There you have your Fab button.
来源:https://stackoverflow.com/questions/37073935/how-to-add-floating-button-on-top-of-the-uitableview