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
Showing
10 changed files
with
876 additions
and
204 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 @@ | ||
xcuserdata |
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,25 @@ | ||
// | ||
// LRStatusView.h | ||
// ModalStatusOverlay | ||
// | ||
// Created by Ricky Hussmann on 5/6/11. | ||
// Copyright 2011 LovelyRide. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
|
||
@interface LRStatusView : UIView { | ||
|
||
UIView *_backgroundView; | ||
UILabel *_statusLabel; | ||
UIActivityIndicatorView *_activityIndicator; | ||
} | ||
|
||
- (id)initWithFrame:(CGRect)frame labelText:(NSString*)text indicatorVisible:(BOOL)indicatorVisible; | ||
|
||
@property (nonatomic, retain) UIView *_backgroundView; | ||
@property (nonatomic, retain) UILabel *_statusLabel; | ||
@property (nonatomic, retain) UIActivityIndicatorView *_activityIndicator; | ||
|
||
@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,110 @@ | ||
// | ||
// LRStatusView.m | ||
// ModalStatusOverlay | ||
// | ||
// Created by Ricky Hussmann on 5/6/11. | ||
// Copyright 2011 LovelyRide. All rights reserved. | ||
// | ||
|
||
#import <QuartzCore/QuartzCore.h> | ||
#import "LRStatusView.h" | ||
|
||
UIView* createBackgroundViewForFrame(CGRect frame) { | ||
|
||
CGRect bgRect = CGRectMake(0, | ||
0, | ||
frame.size.width, | ||
frame.size.height); | ||
|
||
UIView *background = [[[UIView alloc] initWithFrame:bgRect] autorelease]; | ||
background.backgroundColor = [UIColor blackColor]; | ||
background.alpha = 0.2; | ||
background.layer.cornerRadius = 7; | ||
|
||
return background; | ||
} | ||
|
||
UILabel* createStatusLabelWithTextForFrame(NSString *text, CGRect frame) { | ||
|
||
UILabel *statusLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)] autorelease]; | ||
statusLabel.numberOfLines = 0; | ||
statusLabel.lineBreakMode = UILineBreakModeWordWrap; | ||
statusLabel.text = text; | ||
[statusLabel sizeToFit]; | ||
|
||
CGFloat labelHeight = statusLabel.bounds.size.height; | ||
CGFloat labelWidth = statusLabel.bounds.size.width; | ||
|
||
CGRect labelRect = CGRectMake(frame.size.width/2.0 - labelWidth/2.0, | ||
frame.size.height/2.0 - labelHeight/2.0, | ||
labelWidth, | ||
labelHeight); | ||
statusLabel.frame = labelRect; | ||
statusLabel.backgroundColor = [UIColor clearColor]; | ||
statusLabel.textColor = [UIColor whiteColor]; | ||
statusLabel.shadowColor = [UIColor blackColor]; | ||
statusLabel.shadowOffset = CGSizeMake(-1, 1); | ||
|
||
return statusLabel; | ||
} | ||
|
||
@implementation LRStatusView | ||
@synthesize _backgroundView; | ||
@synthesize _statusLabel; | ||
@synthesize _activityIndicator; | ||
|
||
- (id)initWithFrame:(CGRect)frame labelText:(NSString*)text indicatorVisible:(BOOL)indicatorVisible | ||
{ | ||
self = [super initWithFrame:frame]; | ||
if (self) { | ||
|
||
self.clipsToBounds = YES; | ||
self._backgroundView = createBackgroundViewForFrame(frame); | ||
self._statusLabel = createStatusLabelWithTextForFrame(text, frame); | ||
|
||
UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; | ||
|
||
CGPoint statusLabelCenter = self._statusLabel.center; | ||
CGRect indicatorRect = CGRectMake(statusLabelCenter.x - 20.0/2.0, | ||
statusLabelCenter.y - self._statusLabel.frame.size.height/2.0 - 20, | ||
20, | ||
20); | ||
indicator.frame = indicatorRect; | ||
indicator.hidden = NO; | ||
[indicator startAnimating]; | ||
|
||
self._activityIndicator = indicator; | ||
[indicator release]; | ||
|
||
[self addSubview:self._backgroundView]; | ||
[self addSubview:self._statusLabel]; | ||
|
||
if (indicatorVisible) { | ||
[self addSubview:self._activityIndicator]; | ||
} | ||
} | ||
return self; | ||
} | ||
|
||
- (id)initWithFrame:(CGRect)frame | ||
{ | ||
return [self initWithFrame:frame labelText:@"Label" indicatorVisible:YES]; | ||
} | ||
|
||
/* | ||
// Only override drawRect: if you perform custom drawing. | ||
// An empty implementation adversely affects performance during animation. | ||
- (void)drawRect:(CGRect)rect | ||
{ | ||
// Drawing code | ||
} | ||
*/ | ||
|
||
- (void)dealloc | ||
{ | ||
self._statusLabel = nil; | ||
self._activityIndicator = nil; | ||
[super dealloc]; | ||
} | ||
|
||
@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
7 changes: 7 additions & 0 deletions
7
StatusOverlay.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 |
---|---|---|
@@ -1,15 +1,34 @@ | ||
// | ||
// StatusOverlayViewController.h | ||
// StatusOverlay | ||
// ModalStatusOverlayViewController.h | ||
// ModalStatusOverlay | ||
// | ||
// Created by Ricky Hussmann on 5/13/11. | ||
// Created by Ricky Hussmann on 5/6/11. | ||
// Copyright 2011 LovelyRide. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface StatusOverlayViewController : UIViewController { | ||
|
||
@interface StatusOverlayViewController : UIViewController <UITextFieldDelegate> { | ||
|
||
UIButton *_toggleStatusViewButton; | ||
UISwitch *_activitySwitch; | ||
UITextField *_widthField; | ||
UITextField *_heightFied; | ||
UITextField *_statusText; | ||
|
||
BOOL _isEditingTextField; | ||
UITextField *_activeTextField; | ||
} | ||
|
||
@property (nonatomic, retain) IBOutlet UIButton *_toggleStatusViewButton; | ||
@property (nonatomic, retain) IBOutlet UISwitch *_activitySwitch; | ||
@property (nonatomic, retain) IBOutlet UITextField *_widthField; | ||
@property (nonatomic, retain) IBOutlet UITextField *_heightFied; | ||
@property (nonatomic, retain) IBOutlet UITextField *_statusText; | ||
|
||
@property (nonatomic, assign) BOOL _isEditingTextField; | ||
@property (nonatomic, retain) UITextField *_activeTextField; | ||
|
||
- (IBAction)showLoadingOverlay; | ||
|
||
@end |
Oops, something went wrong.