Code Monkey home page Code Monkey logo

timeline's Introduction

Timeline

Timeline like the Path iOS app

Usage

The timeline is a UIView subclass, and can be taller than the screen. It is best used within a scrollview.

To initialize the timeline, use this code:

let timeline = TimelineView(bulletType: .Diamond, timeFrames: [/*timeFrames*/])

The bullet type can be changed to any of the following types:

public enum BulletType{
	case Circle
	case Hexagon
	case Diamond
	case DiamondSlash
	case Carrot
	case Arrow
}

The time frames must all be instances of the TimeFrame stuct. An array of TimeFrames may look like this:

let frames = [
	TimeFrame(text: "New Year's Day", date: "January 1", image: UIImage(named: "fireworks.jpeg")),
	TimeFrame(text: "That's right. No image is necessary!", date: "No image?", image: nil),
	TimeFrame(text: "Hope this helps someone!", date: "That's it!", image: nil)
]

After the timeline is initialized, it is ready to go. For more customization, you can edit the following properties:

public var timeFrames: [TimeFrame]
  
public var lineColor: UIColor = UIColor.lightGrayColor()
	
public var titleLabelColor: UIColor = UIColor(red: 0/255, green: 180/255, blue: 160/255, alpha: 1)

public var detailLabelColor: UIColor = UIColor(red: 110/255, green: 110/255, blue: 110/255, alpha: 1)

public var bulletType: BulletType = BulletType.Diamond

public var showBulletOnRight: Bool = false

For more precise detail on what these properties do, look at the inline documentation.

At this point, the timeline is completely ready to use. Add it to a scroll view, add constraints, and you are ready to go!

See the sample project for an example of how to do integrate this view into your project.

Conclusion

That's about all there is to it! Hope you find it useful, and let me know if you use it in any production apps. It's great to see my work used by others.

timeline's People

Contributors

bryant1410 avatar edekhayser avatar pawankmrai avatar yonat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

timeline's Issues

Supporting Right Alignment

Hello, I like your Timeline view and I was searching for it, I already use it, but if you can support putting bullets in right ( for supporting Right-to-Left languages like Arabic ).

By adding a new variable to choose the alignment of the Timeline ( Right or Left ).

Dynamic Timeframes and Images presentation problems

Hey, first of all, thank you for your work it has help me a lot. I have some questions and my instinct said those questions are really stupid but even tho I played with your code I ca't this specific things happen:

How can I paint timeframes dynamically so the image below looks more like one timeframe it's contain in a for loop forin lop etc if you please help me with that

screen shot 2015-03-02 at 6 36 27 pm

And the other question is in the section where you paint the image the imageview dont apply the 10 units in the cornerRadius and how can I make the image be the same size as the container in this specific case backgroundViewForImage?

Thank you very much for your response and sorry if those questions are basic but...

Timeline View Height

how to get the timeline view height, i want to change myView height based on the timeline view height

Warning: Attempt to present whose view is not in the window hierarchy!

Hello, im about trying to zoom the image when tapped, but it says 2015-08-07 19:35:59.143 Conferencia[10216:2712164] Warning: Attempt to present <JTSImageViewController: 0x14f034600> on <Conferencia.ViewController: 0x14ed12370> whose view is not in the window hierarchy!

I checked all and the method inside timeline.swift is being called. What else should i put? another viewcontroller for the image zoomed?

Thanks

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.