forked from escoz/QuickDialog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e251dc2
Showing
97 changed files
with
4,458 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
QuickDialog.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.