https://github.com/codemillmatt/pluralsight-ios-fab
Example code for iOS floating action button from Moving Beyond the Basics with Xamarin.Forms course
https://github.com/codemillmatt/pluralsight-ios-fab
Last synced: about 1 year ago
JSON representation
Example code for iOS floating action button from Moving Beyond the Basics with Xamarin.Forms course
- Host: GitHub
- URL: https://github.com/codemillmatt/pluralsight-ios-fab
- Owner: codemillmatt
- License: mit
- Created: 2017-03-04T19:44:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-04T20:08:23.000Z (about 9 years ago)
- Last Synced: 2025-01-21T07:27:39.458Z (over 1 year ago)
- Language: C#
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Demo iOS FAB
FAB as demo'd in fourth module of the [Moving Beyond the Basics with Xamarin.Forms](https://www.pluralsight.com/courses/xamarin-forms-moving-beyond-basics) course.
## Implementation
This is a very simple example, and only meant as a jumping off point. The circle and the "plus sign" on the button were implemented with CoreGraphics.
The drawing of the button occurs in the `Draw` function, which is an overridden function provided by the `UIView` class - which this button derives from.
The `TouchesBegan` and `TouchesEnded` functions are overridden to provide a means for the button to report when the user is interacting with it. During the `TouchesBegan` a "tinting" layer is inserted into the view hierarchy - so provide something of a shadow - so the user can see it's being tapped.
Finally, there is a very simple `EventHandler ButtonPressed` which gets invoked during the `TouchesEnded` function. This is how the button notifies any subscribers that it has been interacted with. (The `EventArgs` is probably unnecessary in this case - since we're only saying it's been touched.)
Hope this helps - and don't forget to rate the course 5 stars! :)