Expand description
Wraps NSButton
on appkit, and UIButton
on iOS and tvOS.
You’d use this type to create a button that a user can interact with. Buttons can be configured a number of ways, and support setting a callback to fire when they’re clicked or tapped.
Some properties are platform-specific; see the documentation for further information.
use cacao::button::Button;
use cacao::view::View;
use crate::cacao::layout::Layout;
let mut button = Button::new("My button title");
button.set_key_equivalent("c");
button.set_action(|| {
println!("My button was clicked.");
});
let my_view : View<()> = todo!();
// Make sure you don't let your Button drop for as long as you need it.
my_view.add_subview(&button);
Structs
Wraps NSButton
on appkit, and UIButton
on iOS and tvOS.
Enums
Represents a bezel style for a button. This is a macOS-specific control, and has no effect under iOS or tvOS.