Coder Social home page Coder Social logo

mc3dboxview's Introduction

MC3DBoxView

Goal of the project

Create a very easy-to-use "2.5D" view.

Here is a screenshot from the sample project:

Sample project screenshot

License

This code is available under the MIT license.

Installation

  1. Drag files from the Classes folder to your project;
  2. #import "MC3DBoxView.h" wherever you want to use it.

Usage

Here's how you create MC3DBoxView and it add to your view hierarchy (example assumes that you do that from a view controller):

    MC3DBoxView *boxView = [[MC3DBoxView alloc] initWithFrame:self.view.bounds
                                                     sideSize:self.view.frame.size
                                                     distance:-500];
    [self.view addSubview:boxView];

sideSize is the size of the view which will be used as the sides of the box. By specifying this parameter, you can make box wider, taller and so on. distance is used to give a perception of depth when box is rotated. Usual values are somewhere between -500 and -2000.

Views for the four sides of the box are available as properties frontView, leftView, rightView, backView. Here's for example, how you would use an image to add texture to them:

    UIColor *bg = [UIColor colorWithPatternImage:[UIImage imageNamed:@"checkers"]];
    
    boxView.frontView.backgroundColor = bg;
    boxView.rightView.backgroundColor = bg;
    boxView.backView.backgroundColor = bg;
    boxView.leftView.backgroundColor = bg;

And here's how you would add, say, a map to one of the sides:

    MKMapView *mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
    [boxView.frontView addSubview:mapView];

mc3dboxview's People

Contributors

baglan avatar

Watchers

 avatar James Cloos avatar

Forkers

eway2012

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.