Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…Field into mjcuva-master

Conflicts:
	JVFloatLabeledTextField/JVFloatLabeledTextField/JVFloatLabeledTextField.m
  • Loading branch information
jverdi committed Oct 16, 2013
2 parents 7e68b7e + c6cd09e commit 93b4612
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ @implementation JVFloatLabeledTextField
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
[self commonInit];
if (self) {
[self commonInit];
}
return self;
}
Expand All @@ -61,7 +60,14 @@ - (void)commonInit
// some basic default fonts/colors
_floatingLabel.font = [UIFont boldSystemFontOfSize:12.0f];
self.floatingLabelTextColor = [UIColor grayColor];
self.floatingLabelActiveTextColor = [UIColor blueColor];

// Set default color to Application's tintColor
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
if (!window){
// Use last object in windows if keyWindow returns nil
window = [[[UIApplication sharedApplication] windows] lastObject];
}
self.floatingLabelActiveTextColor = window.tintColor;
}

- (void)setPlaceholder:(NSString *)placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ - (void)viewDidLoad
CGFloat topOffset = [[UIApplication sharedApplication] statusBarFrame].size.height + self.navigationController.navigationBar.frame.size.height;

UIColor *floatingLabelColor = [UIColor grayColor];
UIColor *floatingLabelActiveColor = [UIColor blueColor];

JVFloatLabeledTextField *titleField = [[JVFloatLabeledTextField alloc] initWithFrame:
CGRectMake(kJVFieldHMargin, topOffset, self.view.frame.size.width - 2 * kJVFieldHMargin, kJVFieldHeight)];
titleField.placeholder = NSLocalizedString(@"Title", @"");
titleField.font = [UIFont systemFontOfSize:kJVFieldFontSize];
titleField.floatingLabel.font = [UIFont boldSystemFontOfSize:kJVFieldFloatingLabelFontSize];
titleField.floatingLabelTextColor = floatingLabelColor;
titleField.floatingLabelActiveTextColor = floatingLabelActiveColor;
titleField.clearButtonMode = UITextFieldViewModeWhileEditing;
[self.view addSubview:titleField];

Expand All @@ -82,7 +80,6 @@ - (void)viewDidLoad
priceField.font = [UIFont systemFontOfSize:kJVFieldFontSize];
priceField.floatingLabel.font = [UIFont boldSystemFontOfSize:kJVFieldFloatingLabelFontSize];
priceField.floatingLabelTextColor = floatingLabelColor;
priceField.floatingLabelActiveTextColor = floatingLabelActiveColor;
[self.view addSubview:priceField];

UIView *div2 = [UIView new];
Expand All @@ -101,7 +98,6 @@ - (void)viewDidLoad
locationField.font = [UIFont systemFontOfSize:kJVFieldFontSize];
locationField.floatingLabel.font = [UIFont boldSystemFontOfSize:kJVFieldFloatingLabelFontSize];
locationField.floatingLabelTextColor = floatingLabelColor;
locationField.floatingLabelActiveTextColor = floatingLabelActiveColor;
[self.view addSubview:locationField];

UIView *div3 = [UIView new];
Expand All @@ -117,7 +113,6 @@ - (void)viewDidLoad
descriptionField.font = [UIFont systemFontOfSize:kJVFieldFontSize];
descriptionField.floatingLabel.font = [UIFont boldSystemFontOfSize:kJVFieldFloatingLabelFontSize];
descriptionField.floatingLabelTextColor = floatingLabelColor;
descriptionField.floatingLabelActiveTextColor = floatingLabelActiveColor;
[self.view addSubview:descriptionField];

[titleField becomeFirstResponder];
Expand Down

0 comments on commit 93b4612

Please sign in to comment.