GithubHelp home page GithubHelp logo

magic_tabs_rubymotion's Introduction

#Magic tabs

Available on Objective-C and RubyMotion

MagicTabs screenshot

#How to use

Add MagicView.rb file to your project. Every tab is just an instance of MagicView class. If you want 2 tabs, just create 2 instances of MagicView. Want 5? Create 5.

magicTab = MagicView.alloc.initWithFrame [[x,y],[width,height]]

MagicTab's frame is important. If you want more than one magic tab, remember that every new tab should be created with:

  • higher WIDTH value (if we don't want them to be like on a screenshot, with a different width)
  • smaller X value (if we want to center it)
  • higher Y value (every new tab should be placed below previous tab, right?)

Now we need to assign z index to our tabs:

magic_tab.set_z_index 1

MagicTabs sizes

Now we can add each tab's title and content views. You can use any UIView for a content, but it would be great if its frame will be equal to magicTab's frame.

magicTab.set_view_title "Cool Title"

#adding tableView as a content

new_frame = [[0,0], [magicTab.frame.size.width, magicTab.frame.size.height]]
tableView = UITableView.alloc.initWithFrame new_frame
tableView.registerClass(UITableViewCell, forCellReuseIdentifier:"cellReuseID")
tableView.setDelegate self
tableView.setDataSource self
magicTab.set_content_view tableView

And don't forget to add magit tab to your view

self.view.addSubview magicTab

magic_tabs_rubymotion's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.