GithubHelp home page GithubHelp logo

nikolilol / nkbedtimeclock-master Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 1.16 MB

A view like the clock of bedtime that can set sleep time and wake time

License: MIT License

Objective-C 99.42% Ruby 0.58%

nkbedtimeclock-master's Introduction

NKBedtimeClock

An Objective-C version copy from LeonardoCardoso
Added 24-hours mechanism based on the origin version.
This is a view like the clock of bedtime that can set sleep time, wake time and sleep duration time.

ScreenShot.gif

Init

// Time jumps at each five minutes
int sleepTime = 1320; // Hour: 22:00
int wakeTime = 360;   // Hour: 06:00
NKBedtimeClock *bedtimeClock = [[NKBedtimeClock alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width) sleepTimeInMinutes:sleepTime wakeTimeInMinutes:wakeTime];
bedtimeClock.delegate = self;
[contentView addSubview:bedtimeClock];

delegate

Watch the changes using this snippet:

- (void)NKBedtimeClock:(NKBedtimeClock *)bedtimeClock didUpdateSleepTime:(NSString *)sleepTime wakeTime:(NSString *)wakeTime sleepDuration:(NSString *)sleepDuration{

NSLog(@"sleepTime:%@, wakeTime:%@, sleepDuration:%@", sleepTime, wakeTime, sleepDuration);
}

Palette

You can change the colors whenever you want. Let's say if you want to give an impression of enabling and disabling the clock. To do so, use this function:

// Change nil for the color of your choice
self.bedtimeClock.trackBackgroundColor = nil
...
also{
trackBackgroundColor = nil,
centerBackgroundColor = nil,
wakeBackgroundColor = nil,
wakeColor = nil,
sleepBackgroundColor = nil,
sleepColor = nil,
trackColor = nil,
numberColor = nil,
thickPointerColor = nil,
thinPointerColor = nil,
centerLabelColor = nil
}

See below the full color reference:

palette.jpeg

License

BedtimeClock is released under the MIT license. See LICENSE for details.

nkbedtimeclock-master's People

Contributors

nikolilol avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nkbedtimeclock-master's Issues

iOS 12 error

CoreGraphics CG::Path::add_arc_relative(CGPoint const&, double, double, double, CGAffineTransform const*)
5 CoreGraphics CGPathAddArc + 216
6 UIKitCore -[UIBezierPath addArcWithCenter:radius:startAngle:endAngle:clockwise:] 

ios12适配问题

在ios12机型上面点击就出出现图偏移到左上角,希望你能够修复下

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.