Giter Site home page Giter Site logo

tomatohorizontalmenu's Introduction

TomatoHorizontalMenu Framework

Development and compatibility

Development platform: iOS
Language: Swift
UI framework: UIKit
Compatibility: iOS 13 or greater

Description

TomatoHorizontalMenu lets you create a horizontally-scrollable menu right below the navigation controller for switching from one view controller to another. The following is a list of features.

  1. List a number of tappable sub-menus, each of which corresponds to a specific view controller.
  2. The default height of the horizontal menu is 60 points and can be flexible.
  3. The default space between the tappable labels is 30 points can be flexible.
  4. You have options of letting the framework set auto layout such that the horizontal menu will automatically adjust when the device is lotated.
  5. You can customize the highlighted label text color and non-highlighted label text color.

Installation

  1. In order to use this framework, download the sample project. You will find the folder titled TomatoHorizontalMenu Framework. Locate the Xcode file inside. And put this Xcode file in your Xcode project. Select your target and make sure you have TomatoHorizontalMenu under General > Framworks, Libraries, and Embeded Content as shown below.

  1. Create a sub-class of UIViewController. Name it BasicViewController, BaseViewController, RootViewController or whatever you want such that all child view controllers can be based on. For now, let us call this base view controller BasicViewController. Import TomatoHorizontalMenu to the view controller.

  2. In the base view controller, set the class to TomatoHorizontalBaseController. Create a function to set up the menu. Let us call this function setup. Also create an override function named switchViewController.

  3. In the setup function, create an array of menu models with TomatoHorizontalMenuModel. This struct takes two properties: name (String) and index (Int). The name property is the name of a sub-menu that appears on the horizontal menu. Each sub-menu is supposed to point to a specific view controller. The index property determines the order of appearance.

  4. Use the switchViewController function to read sender view's tag to direct the app to a specific view controller. The following is an example.

  1. In each view controller to which the app is directed to, change the class to BasicViewController. In its viewDidLoad method, set an integer (tag) to viewIndex. Also, call the setup function.

Variables

  • menuHeight: It's the height of the horizontal menu. The default height is 60 points.
  • labelTextColor: It's the text color over the sub-menu.
  • labelHighlightTextColor: It's the text color over the sub-menu for the currently-selected view controller.
  • labelHeight: It's the height of the text label over the sub-menu.
  • labelFontSize: It's the font size of the text label over the sub-menu.
  • menuHighlightColor: It's the color of the sub-menu for the currently-selected view controller.
  • menuHighlightHeight: It's the height of the horizontal hightlight line.
  • spaceBetween: It's the space between two sub-menus.
  • boxBorderColor: It's the border color around the horizontal scroll view.
  • borderWidth: It's the weight of the border around the horizontal scroll view.
  • showHorizontalScroller: It's a boolean value as to whether or not to show the horizontal scroller.
  • scrollBackColor: It's the background color of the horizontal scroll view.
  • hasLayoutConstraints: Set it to true if you want the framework to set autolayout constraints.
  • autoScroll: If you set it to true, the selected sub-menu will appear to the left after the user switches view controllers.
  • Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo 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.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google โค๏ธ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.