• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    Objective-C
  • License
    Other
  • Created over 13 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Stylable and extensible month calendar view for iPhone

Introduction

ios-calendar is a stylable month calendar view for use in iPhone applications.

It has two branches:

  • three20 uses Three20 framework for styling
  • master allows you customize it without using Three20. It uses Nimbus, so it’s good idea to use Nimbus CSS for styling.

Note that README right now is a bit out of date and applies mostly to three20 branch, however the demo and tests are up-to-date.

While there are existing implementations (Kal and TKCalendarMonthView from Tapku Library, they are quite limited. In particular they both replicate styling and functionality of iPhone Calendar app and there is basically no easy way to adjust them. In addition to this – only portrait view is supported in them.

ios-calenar was developed to solve aforementioned problems. It’s default design is heavily inspired by MoMa iPhone app.

I maintain a list of apps using ios-calendar, feel free to add your app to it.

Project setup

While not elegant at all, currently the best method to add ios-calendar to your project is just to drop its source code in it (from “Calendar” group).
It is possible to use it as dependency, but only when your project doesn’t itself use Three20. Otherwise build results in XCode crash. I’m looking for suggestions on how better to resolve this issue.

Usage sample

XCode project on GitHub contains sample target – CalendarDemo. Here are main highlights:

CalendarDemoViewController.m

#import "CalendarDemoViewController.h"

#import <Three20UICommon/Three20UICommon+Additions.h>

@implementation CalendarDemoViewController

@synthesize calendarView;

- (void) loadView {
    [super loadView];

    self.calendarView = [[CXCalendarView new] autorelease];
    [self.view addSubview: self.calendarView];
    self.calendarView.frame = self.view.bounds;
    self.calendarView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    self.calendarView.selectedDate = [NSDate date];

    self.calendarView.delegate = self;
}

- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation {
    return YES;
}

#pragma mark CXCalendarViewDelegate

- (void) calendarView: (CXCalendarView *) calendarView
        didSelectDate: (NSDate *) date {

    NSLog(@"Selected date: %@", date);
    TTAlert([NSString stringWithFormat: @"Selected date: %@", date]);
}

@end

CalendarDemoAppDelegate.m

There is one very important thing to do in app delegate – set up Three20 styling. There is sample stylesheet (inspired by MoMA) – TestStyleSheet.

#import "CalendarDemoAppDelegate.h"

#import "TestStyleSheet.h"
#import "CalendarDemoViewController.h"

@implementation CalendarDemoAppDelegate

@synthesize window = _window;
@synthesize viewController = _viewController;

- (BOOL) application: (UIApplication *) application didFinishLaunchingWithOptions: (NSDictionary *) launchOptions {
    [TTStyleSheet setGlobalStyleSheet: [[TestStyleSheet new] autorelease]];

    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.viewController = [[CalendarDemoViewController alloc] init];
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

@end

Styling

Here’s default stylesheet for you to study:

#import "TestStyleSheet.h"

@implementation TestStyleSheet

- (TTStyle *) calendarCellStyle: (UIControlState) state {
    if (state & UIControlStateDisabled) {
        return [TTTextStyle styleWithColor: [UIColor clearColor] next: nil];
    }

    if (state & UIControlStateSelected) {
        return [TTSolidFillStyle styleWithColor: [UIColor grayColor] next:
                [TTTextStyle styleWithColor: [UIColor whiteColor] next: nil]];
    }

    return [TTTextStyle styleWithColor: [UIColor grayColor] next: nil];
}

- (TTStyle *) calendarMonthBarStyle {
    return
    [TTLinearGradientFillStyle styleWithColor1: RGBCOLOR(188, 200, 215)
                                        color2: RGBCOLOR(125, 150, 179) next:
     [TTFourBorderStyle styleWithTop: RGBCOLOR(213, 221, 230)
                               right: nil
                              bottom: RGBCOLOR(57, 70, 84)
                                left: nil
                               width: 1 next: nil]];

}

- (TTStyle *) calendarMonthBackButton: (UIControlState) state {
    return
    [TTTextStyle styleWithFont: [UIFont systemFontOfSize: [UIFont buttonFontSize]]
                         color: [UIColor whiteColor]
                   shadowColor: [UIColor grayColor]
                  shadowOffset: CGSizeMake(0, 1) next: nil];
}

- (TTStyle *) calendarMonthForwardButton: (UIControlState) state {
    return
    [TTTextStyle styleWithFont: [UIFont systemFontOfSize: [UIFont buttonFontSize]]
                         color: [UIColor whiteColor]
                   shadowColor: [UIColor grayColor]
                  shadowOffset: CGSizeMake(0, 1) next: nil];
}

- (TTStyle *) calendarMonthLabelStyle {
    return
    [TTTextStyle styleWithFont: [UIFont systemFontOfSize: [UIFont buttonFontSize]]
                         color: [UIColor whiteColor]
                   shadowColor: [UIColor grayColor]
                  shadowOffset: CGSizeMake(0, 1) next: nil];
}

- (TTStyle *) calendarGridViewStyle {
    return [TTSolidFillStyle styleWithColor: [UIColor whiteColor] next: nil];
}

@end

License

Code is distributed under MIT license, attribution is appreciated:

Copyright (C) 2011 by Componentix
http://www.componentix.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

More Repositories

1

web4

Web4 is a new way to distribute decentralized apps. Deploy single WASM smart contract to deploy whole web app.
JavaScript
92
star
2

near-lands

Decentralized 2D multiverse project in development using NEAR protocol
JavaScript
59
star
3

file-upload

Simple file upload service done using Node.js
JavaScript
45
star
4

fast-near

Fastest RPC for @near based on Redis/LMDB
JavaScript
34
star
5

human-guild

Help humans to earn money in digital economy
25
star
6

nearfs

Distributed file system compatible with IPFS using NEAR blockchain as a backend.
JavaScript
23
star
7

web4-deploy

Deploy static content for Web4 webapp. Supports IPFS for now.
JavaScript
20
star
8

libxmljs-easy

Work with libmxmljs DOM as with plain Javascript objects.
JavaScript
15
star
9

bananaswap

Minimalistic Uniswap-style automated berry market maker running on NEAR
JavaScript
15
star
10

near-lake-torrents

NEAR blockchain archive distributed using torrents
12
star
11

ukrainian-stemmer

Hardcoded stemmer for Ukrainian language based on http://www.senyk.poltava.ua/projects/ukr_stemming/stemming_about.html
Groovy
11
star
12

web4-littlelink

Self-hosted Linktree alternative to use with web4
CSS
10
star
13

web4-min-contract

Minimal useful Web4 contract. Can be used together with web4-deploy to deploy static websites
Zig
10
star
14

lt-howdoi

LightTable plugin that writes code for you using howdoi
Clojure
10
star
15

elasticsearch-ukrainian-stemmer

Java
10
star
16

bun-in-browser

HTTP reverse proxy which allows to access Bun.js server running in browser via WebSockets
JavaScript
9
star
17

near-state-indexer

NEAR Protocol Indexer pumping data in Redis for https://github.com/vgrichina/fast-near
Rust
9
star
18

httpdump

Packet capture and analysis utility similar to tcpdump for HTTP
Python
8
star
19

functional.js

Unofficial GitHub repo for http://osteele.com/sources/javascript/functional/ by Oliver Steele
JavaScript
8
star
20

smart-linkdrop

Customisable linkdrop contract allowing custom transactions like NFT transfer
JavaScript
5
star
21

ios-autocomplete

Objective-C
4
star
22

fast-ipfs

JavaScript
4
star
23

swift-transducers

Port of Clojure's transducers to Apple's Swift language
Swift
4
star
24

giveprops

Give props using NEAR blockchain
JavaScript
3
star
25

humanguild-nft

JavaScript
3
star
26

Stylus.tmbundle

Extracted TextMate bundle from Stylus into a separate project
3
star
27

topsy_instant

Topsy Instant -- realtime search in Twitter, based on Topsy
3
star
28

geo_twitter

Mashup of Twitter and Google Maps using Grails
Groovy
3
star
29

nimbus-boilerplate

Collection of iOS boilerplate code, especially useful with Nimbus
Objective-C
3
star
30

vim_files

My Vim configuration files, would be mostly targeted for Groovy/Grails development, probably also for haXe
Vim Script
3
star
31

koa2-sequelize-transaction

Koa2 middleware to handle Sequelize transactions automatically
JavaScript
3
star
32

dotz

JavaScript
2
star
33

time-uploader

Uploads exported time from Pomodoro to Redmine
Python
2
star
34

tabless-swiftui

Experimental opinionated browser optimised for my flavor of ADD. If you have 100 of tabs in 10 different windows – tune in.
Swift
2
star
35

near-account-nft

Transform your .near account into a tradable NFT
JavaScript
2
star
36

buttonmen

Rust
2
star
37

berry-wayback

http://berryclub.io/ Wayback Machine
JavaScript
2
star
38

iGrep

Half-assed document indexing for iOS
Objective-C
2
star
39

kissxml

Git clone of http://code.google.com/p/kissxml/
Objective-C
2
star
40

femtoforth

Half-assed incomplete implementation of Forth in C by programmer without understanding of Forth
C
2
star
41

TinyActors

Simple and stupid actor model implementation abusing C# generators
C#
2
star
42

pledgez

Concise BDD framework for Groovy, inspired by Vows
Groovy
1
star
43

near-ledger-keygen

HTML
1
star
44

py-nearfs-upload

Upload files to NEARFS using Python
Python
1
star
45

universal-fungible-token-rs

Rust
1
star
46

web4gpt

JavaScript
1
star
47

near-questdb-indexer

Shell
1
star
48

grails-bean-fields

Fork of http://www.grails.org/plugin/bean-fields
Groovy
1
star
49

following_tool

Simple tool to follow/unfollow users on Twitter conveniently
JavaScript
1
star
50

mtv-projects

Mountain View, CA – Map of active construction projects
HTML
1
star
51

emojihash.js

Generates Emoji strings from hex hash string (for easy eyeballing)
JavaScript
1
star
52

js-notebook

Lightweight and customizable Jupyter-like notebook for JavaScript
HTML
1
star
53

io-ios

Sample iOS project with embedded Io language interpreter
Objective-C
1
star
54

flu_trends

Flu trends from Twitter on Google Maps
Groovy
1
star
55

google-geocoding

Google Geocoding plugin for Grails
Groovy
1
star
56

grails-css-naked-day

Grails Plugin for CSS Naked Day celebration
Java
1
star