Convert Button component to Android/iOS code.

Buttons are the most used components in apps and they have app-specific actions. Buttons can have a title, background, or image as property/class. They may include more than one property. A button can have both properties at the same time. For example, background and title, or title and image, etc.

You can convert rectangles, images and texts in your design into buttons on Monday Hero. All you need to do tagging the elements with the properties. They are already automatically selected by Monday Hero, incase it tags properties wrong you can reselect them anytime. Here are some button examples with the properties:

Buttons have 3 properties in Monday Hero:

Title: The text displayed over the button.

Background: It's the background of the button. It can be either an image or it can be a view like a rectangle.

Image: Icons are good examples of image buttons. They designed for having app-specific actions.

Here is another button example below. In this case, Monday Hero automatically understands the blue rectangle as View and gets background color from the rectangle. So, tagging the "Follow" text as the Title and the rectangle as Background will be enough. How to create a button and add a property/class can be seen in the GIF below.

When the button is created, the generated code will be like below.

Generated iOS/Android Code

The button code created is added to the page with the styles. Constraints are defined in the Storyboard file.

import UIKit

class ProfilePageViewController: UIViewController {
	// MARK: - Properties
  //Connection from an Interface Builder to a UI component
  // The button with an image and text
	@IBOutlet private weak var followButton: UIButton!
	@IBOutlet private weak var buttonImageView: UIImageView!
	//Button with an only image
	@IBOutlet private weak var profileButton: UIButton!

 	//Button with a text and background image
  @IBOutlet private weak var loginButton: UIButton!
	override func viewDidLoad() {

extension ProfilePageViewController {
	private func setupViews() {
		// The button with an image and text
		followButton.layer.cornerRadius = 6
		followButton.layer.masksToBounds =  true 
		followButton.backgroundColor = UIColor.cerulean
		followButton.setTitle(NSLocalizedString("follow", comment: ""),for: .normal)
		followButton.setTitleColor(UIColor.daisy, for: .normal)
		followButton.titleLabel?.font = UIFont.textStyle7
		followButton.contentHorizontalAlignment = .leading 
		followButton.contentEdgeInsets = UIEdgeInsets(top: 6, left: 9 , bottom: 6, right: 9)

		//Button with an only image
		profileButton.setImage(UIImage(named: "profileIcon") , for: .normal)
		//Button with a text and background image
		loginButton.setTitle(NSLocalizedString("login", comment: ""),for: .normal)
		loginButton.setTitleColor(UIColor.white, for: .normal)
		loginButton.titleLabel?.font = UIFont.textStyle2
		loginButton.contentHorizontalAlignment = .center 
		loginButton.setBackgroundImage(UIImage(named: "loginBackground") , for: .normal)

	private func setupLayout() { 
		//Constraints are defined in Storyboard file.

That's all for creating buttons on Monday Hero.

Last updated