Skip to content

Commit

Permalink
Improve keyboard accessory ui
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Sep 29, 2012
1 parent fc45063 commit 8f7a608
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Classes/CDIAddTaskView.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ - (id)initWithFrame:(CGRect)frame {
_textField.returnKeyType = UIReturnKeyGo;
_textField.font = [UIFont cheddarFontOfSize:18.0f];

CDIKeyboardBar *keyboardBar = [[CDIKeyboardBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 36.0f)];
CDIKeyboardBar *keyboardBar = [[CDIKeyboardBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, size.width, UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 54.0f : 36.0f)];
keyboardBar.textField = _textField;
_textField.inputAccessoryView = keyboardBar;
[self addSubview:_textField];
Expand Down
4 changes: 2 additions & 2 deletions Classes/CDIKeyboardBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (id)initWithFrame:(CGRect)frame {


- (CGSize)sizeThatFits:(CGSize)size {
size.height = 36.0f;
size.height = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 54.0f : 36.0f;
size.width = fmaxf(size.width, 320.0f);
return size;
}
Expand All @@ -66,7 +66,7 @@ - (void)layoutSubviews {
CGFloat height = self.bounds.size.height;
for (NSUInteger i = 0; i < count; i++) {
UIButton *button = _buttons[i];
button.frame = CGRectMake((CGFloat)i * width, 0.0f, width, height);
button.frame = CGRectMake((CGFloat)i * width, 1.0f, width, height - 1.0f);
}
}

Expand Down
13 changes: 13 additions & 0 deletions Classes/CDIKeyboardButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,17 @@ - (id)initWithCharacter:(NSString *)character {
return self;
}


- (void)drawRect:(CGRect)rect {
[super drawRect:rect];

CGContextRef context = UIGraphicsGetCurrentContext();

[[UIColor colorWithRed:0.910f green:0.910f blue:0.922f alpha:1.0f] setFill];
CGContextFillRect(context, CGRectMake(0.0f, 0.0f, 1.0f, self.bounds.size.height));

[[UIColor colorWithRed:0.643f green:0.643f blue:0.651f alpha:1.0f] setFill];
CGContextFillRect(context, CGRectMake(self.bounds.size.width - 1.0f, 0.0f, 1.0f, self.bounds.size.height));
}

@end

0 comments on commit 8f7a608

Please sign in to comment.