Skip to content

Commit

Permalink
First commit to github.
Browse files Browse the repository at this point in the history
  • Loading branch information
escoz committed Aug 12, 2011
0 parents commit e251dc2
Show file tree
Hide file tree
Showing 97 changed files with 4,458 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.DS_Store
*.swp
*~.nib

build/

*.pbxuser
*.perspective
*.perspectivev3

*.mode1v3
*.mode2v3

xcuserdata
.idea/*
575 changes: 575 additions & 0 deletions QuickDialog.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
QuickDialog
============

Quick and simple dialog creation for iOS users.

ATTENTION: this is definitely not ready to be used yet. Several bugs and interface changes will be done over the next days/weeks.

If you're interested in helping with development, please contact me! I would appreciate any help!

You'll need to use the XCode 4.2 beta to run this code. It depends on ARC for memory management.
Binary file added other/quickdialog-logo.psd
Binary file not shown.
7 changes: 7 additions & 0 deletions quickdialog.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions quickdialog/BadgeElement.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Created by escoz on 7/13/11.
//
// To change this template use File | Settings | File Templates.
//


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class LabelElement;
@class RootElement;


@interface BadgeElement : LabelElement {

@private
UIColor *_badgeColor;
NSString *_badge;
}

@property(nonatomic, retain) UIColor *badgeColor;
@property(nonatomic, strong) NSString *badge;


- (BadgeElement *)initWithTitle:(NSString *)title Value:(NSString *)value;
@end
37 changes: 37 additions & 0 deletions quickdialog/BadgeElement.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Created by escoz on 7/13/11.
//

#import "BadgeTableCell.h"
#import "QuickDialogTableView.h"


@implementation BadgeElement
@synthesize badgeColor = _badgeColor;
@synthesize badge = _badge;


- (BadgeElement *)initWithTitle:(NSString *)title Value:(NSString *)value {
self = [super init];
_title = title;
_badge = value;
_badgeColor = [UIColor colorWithRed:0.530f green:0.600f blue:0.738f alpha:1.000f];
return self;

}
- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller {
BadgeTableCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QuickformBadgeElement"];
if (cell==nil){
cell = [[BadgeTableCell alloc] init];
}
cell.textLabel.text = _title;
cell.badgeLabel.text = _badge;
cell.badgeColor = _badgeColor;
cell.imageView.image = _image;
cell.accessoryType = self.sections!= nil || self.controllerAction!=nil ? UITableViewCellAccessoryDisclosureIndicator : UITableViewCellAccessoryNone;
cell.selectionStyle = self.sections!= nil || self.controllerAction!=nil ? UITableViewCellSelectionStyleBlue: UITableViewCellSelectionStyleNone;
[cell setNeedsDisplay];
return cell;
}

@end
22 changes: 22 additions & 0 deletions quickdialog/BadgeTableCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Created by escoz on 7/13/11.
//


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


@interface BadgeTableCell : UITableViewCell {

@private
UIColor *_badgeColor;
UILabel *_badgeLabel;
}
- (BadgeTableCell *)init;


@property(nonatomic, retain) UIColor *badgeColor;
@property(nonatomic, readonly, strong) UILabel *badgeLabel;

@end
55 changes: 55 additions & 0 deletions quickdialog/BadgeTableCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// Created by escoz on 7/13/11.
//

#import "BadgeTableCell.h"
#import <QuartzCore/QuartzCore.h>

@interface BadgeTableCell ()
@end

@implementation BadgeTableCell

@synthesize badgeColor = _badgeColor;
@synthesize badgeLabel = _badgeLabel;


- (BadgeTableCell *)init {
self = [super initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"QuickformBadgeElement"];
if (self){
_badgeColor = [UIColor colorWithRed:0.530f green:0.600f blue:0.738f alpha:1.000f];
_badgeLabel = [[UILabel alloc] init];
[self.contentView addSubview:_badgeLabel];
self.selectionStyle = UITableViewCellSelectionStyleNone;

_badgeLabel.backgroundColor = _badgeColor;
_badgeLabel.textColor = [UIColor whiteColor];
_badgeLabel.backgroundColor = [UIColor clearColor];
_badgeLabel.textAlignment = UITextAlignmentCenter;
_badgeLabel.font = [UIFont boldSystemFontOfSize:14];

}
return self;
}

- (void) drawRect:(CGRect)rect
{
[_badgeLabel sizeToFit];
_badgeLabel.frame= CGRectMake(self.contentView.frame.size.width-_badgeLabel.frame.size.width-_badgeLabel.frame.size.height, 12, _badgeLabel.frame.size.width, _badgeLabel.frame.size.height);

CGContextRef context = UIGraphicsGetCurrentContext();
float radius = _badgeLabel.frame.size.height / 2.0f;

CGContextSaveGState(context);
CGContextSetFillColorWithColor(context, [_badgeColor CGColor]);
CGContextBeginPath(context);
CGContextAddArc(context, _badgeLabel.frame.origin.x , _badgeLabel.frame.origin.y + radius, radius, (CGFloat)M_PI_2 , 3.0f * (CGFloat)M_PI_2, NO);
CGContextAddArc(context, _badgeLabel.frame.origin.x + _badgeLabel.frame.size.width, _badgeLabel.frame.origin.y + radius, radius, 3.0f * (CGFloat)M_PI_2, (CGFloat)M_PI_2, NO);
CGContextClosePath(context);
CGContextFillPath(context);
CGContextRestoreGState(context);
}



@end
30 changes: 30 additions & 0 deletions quickdialog/BooleanElement.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Created by escoz on 7/8/11.
//
// To change this template use File | Settings | File Templates.
//


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class Element;
@class LabelElement;

@interface BooleanElement : LabelElement {
BOOL _boolValue;
BOOL _enabled;
@private
UIImage *_onImage;
UIImage *_offImage;
}

@property(nonatomic, retain) UIImage *onImage;
@property(nonatomic, retain) UIImage *offImage;
@property (nonatomic) BOOL boolValue;
@property(nonatomic) BOOL enabled;

- (BooleanElement *)initWithTitle:(NSString *)title BoolValue:(BOOL)value;

- (void)switched:(id)switched;
@end
77 changes: 77 additions & 0 deletions quickdialog/BooleanElement.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// Created by escoz on 7/8/11.
//
// To change this template use File | Settings | File Templates.
//


#import "Element.h"
#import "LabelElement.h"
#import "BooleanElement.h"
#import "QuickDialogTableView.h"


@implementation BooleanElement


@synthesize onImage = _onImage;
@synthesize offImage = _offImage;
@synthesize boolValue = _boolValue;
@synthesize enabled = _enabled;


- (BooleanElement *)init {
self = [self initWithTitle:nil BoolValue:YES];
return self;
}

- (BooleanElement *)initWithTitle:(NSString *)title BoolValue:(BOOL)value {
self = [self initWithTitle:title Value:nil];
_boolValue = value;
_enabled = YES;
return self;
}

- (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller {
UITableViewCell *cell = [super getCellForTableView:tableView controller:controller];
cell.accessoryType = self.sections!= nil || self.controllerAction!=nil ? UITableViewCellAccessoryDisclosureIndicator : UITableViewCellAccessoryNone;
cell.selectionStyle = self.sections!= nil || self.controllerAction!=nil ? UITableViewCellSelectionStyleBlue: UITableViewCellSelectionStyleNone;

if ((_onImage==nil) && (_offImage==nil)) {
UISwitch *boolSwitch = [[UISwitch alloc] init];
boolSwitch.on = _boolValue;
boolSwitch.enabled = _enabled;
[boolSwitch addTarget:self action:@selector(switched:) forControlEvents:UIControlEventValueChanged];
cell.accessoryView = boolSwitch;

} else {
UIImageView *boolSwitch = [[UIImageView alloc] initWithImage: _boolValue ? _onImage : _offImage];
cell.accessoryView = boolSwitch;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
}

return cell;
}

- (void)selected:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller indexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
_boolValue = !_boolValue;
if ([cell.accessoryView class] == [UIImageView class]){
((UIImageView *)cell.accessoryView).image = _boolValue ? _onImage : _offImage;
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}


- (void)switched:(id)boolSwitch {
_boolValue = ((UISwitch *)boolSwitch).on;
}

- (void)fetchValueIntoObject:(id)obj {
if (_key==nil)
return;
[obj setValue:[NSNumber numberWithBool:_boolValue] forKey:_key];
}


@end
20 changes: 20 additions & 0 deletions quickdialog/ButtonElement.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Created by escoz on 7/11/11.
//
// To change this template use File | Settings | File Templates.
//


#import <Foundation/Foundation.h>

@class Element;
@class LabelElement;


@interface ButtonElement : LabelElement {

}

- (ButtonElement *)initWithTitle:(NSString *)title;

@end
44 changes: 44 additions & 0 deletions quickdialog/ButtonElement.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Created by escoz on 7/11/11.
//
// To change this template use File | Settings | File Templates.
//


#import "Element.h"
#import "LabelElement.h"
#import "ButtonElement.h"
#import "QuickDialogTableView.h"
#import "QuickDialogController.h"


@implementation ButtonElement



- (ButtonElement *)initWithTitle:(NSString *)title {
self = [super initWithTitle:title Value:nil];
return self;
}

- (UITableViewCell *)getCellForTableView:(UITableView *)tableView controller:(QuickDialogController *)controller {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QuickformButtonElement"];
if (cell == nil){
cell= [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"TODO"];
}
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
cell.textLabel.text = _title;
cell.textLabel.textAlignment = UITextAlignmentCenter;
cell.textLabel.textColor = [UIColor colorWithRed:50.0f/255.0f green:79.0f/255.0f blue:133.0f/255.0f alpha:1];
return cell;
}

- (void)selected:(QuickDialogTableView *)tableView controller:(QuickDialogController *)controller indexPath:(NSIndexPath *)indexPath {
[super selected:tableView controller:controller indexPath:indexPath];


[tableView deselectRowAtIndexPath:indexPath animated:YES];
}


@end
24 changes: 24 additions & 0 deletions quickdialog/DateEntryTableViewCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Created by escoz on 7/15/11.
//
// To change this template use File | Settings | File Templates.
//


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class EntryTableViewCell;


@interface DateEntryTableViewCell : EntryTableViewCell {

UIDatePicker *_pickerView;
@private
UILabel *_centeredLabel;
}
@property(nonatomic, strong) UIDatePicker *pickerView;

@property(nonatomic, retain) UILabel *centeredLabel;

@end
Loading

0 comments on commit e251dc2

Please sign in to comment.