From 05106d987d3eadc018ffdd545995c1d162b8fb7f Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Thu, 30 Sep 2010 05:42:08 +0800 Subject: [PATCH 01/13] adds placeholder support to LPMultiLineTextField --- LPMultiLineTextField.j | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/LPMultiLineTextField.j b/LPMultiLineTextField.j index b8b53b1..18a6414 100644 --- a/LPMultiLineTextField.j +++ b/LPMultiLineTextField.j @@ -64,9 +64,7 @@ var CPTextFieldInputOwner = nil; - (id)initWithFrame:(CGRect)aFrame { - if (self = [super initWithFrame:aFrame]) - { - } + if (self != [super initWithFrame:aFrame]) return nil; return self; } @@ -96,6 +94,7 @@ var CPTextFieldInputOwner = nil; { [super layoutSubviews]; + var contentView = [self layoutEphemeralSubviewNamed:@"content-view" positioned:CPWindowAbove relativeToEphemeralSubviewNamed:@"bezel-view"]; @@ -133,8 +132,8 @@ var CPTextFieldInputOwner = nil; default: DOMElement.style.textAlign = "left"; } - - DOMElement.value = _stringValue || @""; + + DOMElement.value = ([self hasThemeState:CPTextFieldStatePlaceholder]) ? _placeholderString : (_stringValue || @""); if(_hideOverflow) DOMElement.style.overflow=@"hidden"; @@ -209,6 +208,7 @@ var CPTextFieldInputOwner = nil; _stringValue = [self stringValue]; [self setThemeState:CPThemeStateEditing]; + [self _updatePlaceholderState]; setTimeout(function(){ [self _DOMTextareaElement].focus(); @@ -223,7 +223,7 @@ var CPTextFieldInputOwner = nil; - (BOOL)resignFirstResponder { [self unsetThemeState:CPThemeStateEditing]; - + [self _updatePlaceholderState]; [self setStringValue:[self stringValue]]; [self _DOMTextareaElement].blur(); @@ -245,12 +245,14 @@ var CPTextFieldInputOwner = nil; - (CPString)stringValue { + if ([self hasThemeState:CPTextFieldStatePlaceholder]) return @""; return (!!_DOMTextareaElement) ? _DOMTextareaElement.value : @""; } - (void)setStringValue:(CPString)aString { _stringValue = aString; + [self _updatePlaceholderState]; [self setNeedsLayout]; } From ffe60cf5b5996c28eb29e94bed9a0cff02035323 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Thu, 14 Oct 2010 17:57:23 +0800 Subject: [PATCH 02/13] =?UTF-8?q?fixes=20circumstance=20where=20a=20non-ed?= =?UTF-8?q?itable=20multiline=20text=20field=E2=80=99s=20value=20is=20erro?= =?UTF-8?q?neously=20determined=20by=20its=20placeholder=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LPMultiLineTextField.j | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/LPMultiLineTextField.j b/LPMultiLineTextField.j index 18a6414..fd0f188 100644 --- a/LPMultiLineTextField.j +++ b/LPMultiLineTextField.j @@ -92,6 +92,7 @@ var CPTextFieldInputOwner = nil; - (void)layoutSubviews { + [super layoutSubviews]; @@ -132,8 +133,8 @@ var CPTextFieldInputOwner = nil; default: DOMElement.style.textAlign = "left"; } - - DOMElement.value = ([self hasThemeState:CPTextFieldStatePlaceholder]) ? _placeholderString : (_stringValue || @""); + + DOMElement.value = ([self hasThemeState:CPTextFieldStatePlaceholder] && [self isEditable]) ? _placeholderString : (_stringValue || @""); if(_hideOverflow) DOMElement.style.overflow=@"hidden"; @@ -245,7 +246,10 @@ var CPTextFieldInputOwner = nil; - (CPString)stringValue { - if ([self hasThemeState:CPTextFieldStatePlaceholder]) return @""; + if ([self hasThemeState:CPTextFieldStatePlaceholder]) + if (!_DOMTextareaElement) + return nil; + return (!!_DOMTextareaElement) ? _DOMTextareaElement.value : @""; } From ebd886ac1b11c2561f9c4ea6c0b7264fe13c48ed Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Fri, 15 Oct 2010 11:47:09 +0800 Subject: [PATCH 03/13] fixes bug where the placeholder gets carried over because of an invisible-then regression in 83406ffc9c9977a9ccd89474fda936a1e1a15497. revises the handling of object values and string values and conforms it to CPTextField for easy bindings support in the future --- LPMultiLineTextField.j | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/LPMultiLineTextField.j b/LPMultiLineTextField.j index fd0f188..a195a22 100644 --- a/LPMultiLineTextField.j +++ b/LPMultiLineTextField.j @@ -133,8 +133,16 @@ var CPTextFieldInputOwner = nil; default: DOMElement.style.textAlign = "left"; } + + if ([self hasThemeState:CPTextFieldStatePlaceholder]) { + + DOMElement.value = [self placeholderString]; + + } else { - DOMElement.value = ([self hasThemeState:CPTextFieldStatePlaceholder] && [self isEditable]) ? _placeholderString : (_stringValue || @""); + DOMElement.value = [self stringValue]; + + } if(_hideOverflow) DOMElement.style.overflow=@"hidden"; @@ -182,10 +190,12 @@ var CPTextFieldInputOwner = nil; - (void)keyUp:(CPEvent)anEvent { - if (_stringValue !== [self stringValue]) + var oldStringValue = [self stringValue]; + [self _setStringValue:[self _DOMTextareaElement].value]; + + if (oldStringValue !== [self stringValue]) { - _stringValue = [self stringValue]; - + if (!_isEditing) { _isEditing = YES; @@ -244,20 +254,22 @@ var CPTextFieldInputOwner = nil; return YES; } -- (CPString)stringValue +- (void)_setStringValue:(id)aValue { - if ([self hasThemeState:CPTextFieldStatePlaceholder]) - if (!_DOMTextareaElement) - return nil; - - return (!!_DOMTextareaElement) ? _DOMTextareaElement.value : @""; + [self willChangeValueForKey:@"objectValue"]; + [super setObjectValue:String(aValue)]; + [self _updatePlaceholderState]; + [self didChangeValueForKey:@"objectValue"]; } -- (void)setStringValue:(CPString)aString +- (void)setObjectValue:(id)aValue { - _stringValue = aString; + [super setObjectValue:aValue]; + + if (CPTextFieldInputOwner === self || [[self window] firstResponder] === self) + [self _DOMTextareaElement].value = aValue; + [self _updatePlaceholderState]; - [self setNeedsLayout]; } @end From 568577b04f6a38156d079f4ebeda8f0c77b0baa9 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Fri, 15 Oct 2010 13:26:00 +0800 Subject: [PATCH 04/13] in LPMultiLineTextField, adds code that explicitly works with _originalPlaceholderString, so the placeholder is always correct even if the field has binding. --- LPMultiLineTextField.j | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/LPMultiLineTextField.j b/LPMultiLineTextField.j index a195a22..cc5e18a 100644 --- a/LPMultiLineTextField.j +++ b/LPMultiLineTextField.j @@ -115,7 +115,7 @@ var CPTextFieldInputOwner = nil; DOMElement.style.color = [[self currentValueForThemeAttribute:@"text-color"] cssString]; DOMElement.style.font = [[self currentValueForThemeAttribute:@"font"] cssString]; - + switch ([self currentValueForThemeAttribute:@"alignment"]) { case CPLeftTextAlignment: @@ -133,11 +133,12 @@ var CPTextFieldInputOwner = nil; default: DOMElement.style.textAlign = "left"; } - + + // We explicitly want a placeholder when the value is an empty string. if ([self hasThemeState:CPTextFieldStatePlaceholder]) { - + DOMElement.value = [self placeholderString]; - + } else { DOMElement.value = [self stringValue]; @@ -272,6 +273,16 @@ var CPTextFieldInputOwner = nil; [self _updatePlaceholderState]; } +- (void) _setCurrentValueIsPlaceholder:(BOOL)isPlaceholder { + +// Under certain circumstances, _originalPlaceholderString is empty. + if (!_originalPlaceholderString) + _originalPlaceholderString = [self placeholderString]; + + [super _setCurrentValueIsPlaceholder:isPlaceholder]; + +} + @end @@ -297,4 +308,4 @@ var LPMultiLineTextFieldStringValueKey = "LPMultiLineTextFieldStringValueKey", [aCoder encodeBool:(_hideOverflow?NO:YES) forKey:LPMultiLineTextFieldScrollableKey]; } -@end +@end \ No newline at end of file From 44d0d3457fb16f46f435acd3f48bcbcfcdeb19d9 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Fri, 29 Oct 2010 21:36:33 +0800 Subject: [PATCH 05/13] in LPSwitch, adds a default size for theme attribute knob-size, so setting ON/OFF initially would work --- LPSwitch.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LPSwitch.j b/LPSwitch.j index 8313223..c01af71 100644 --- a/LPSwitch.j +++ b/LPSwitch.j @@ -62,7 +62,7 @@ + (id)themeAttributes { - return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null]] + return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], [CPNull null], CGSizeMake(30.0, 24.0), [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null]] forKeys:[@"off-background-color", @"on-background-color", @"knob-background-color", @"knob-size", @"label-offset", @"off-label-font", @"off-label-text-color", @"off-label-text-shadow-color", @"off-label-text-shadow-offset", @"on-label-font", @"on-label-text-color", @"on-label-text-shadow-color", @"on-label-text-shadow-offset"]]; From d4b7aeaddf2cc53f9783c0a66ee4f68ca005e91d Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Thu, 4 Nov 2010 01:50:06 +0800 Subject: [PATCH 06/13] fixes bug where when a custom grid view is set, its frame is not reconfigured by LPChartView --- LPChartView.j | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LPChartView.j b/LPChartView.j index c20291c..03ee889 100644 --- a/LPChartView.j +++ b/LPChartView.j @@ -128,8 +128,13 @@ var labelViewHeight = 20, [aGridView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; [self replaceSubview:gridView with:aGridView]; - + + var gridViewFrame = [drawView frame]; + gridViewFrame.height -= 1; + [aGridView setFrame:gridViewFrame]; + gridView = aGridView; + } - (void)setDisplayLabels:(BOOL)shouldDisplayLabels From 3c4b8b15d6ed97615544a1c308e2517430fb2e47 Mon Sep 17 00:00:00 2001 From: Houdini Date: Thu, 4 Nov 2010 10:03:53 +0300 Subject: [PATCH 07/13] quickfix: Some times setStringValue do not relly update text inside textarea. I suppose real bug is inside CPView --- LPMultiLineTextField.j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LPMultiLineTextField.j b/LPMultiLineTextField.j index b8b53b1..0773674 100644 --- a/LPMultiLineTextField.j +++ b/LPMultiLineTextField.j @@ -252,6 +252,9 @@ var CPTextFieldInputOwner = nil; { _stringValue = aString; [self setNeedsLayout]; + if (!!_DOMTextareaElement) + if (aString !== _DOMTextareaElement.value) + _DOMTextareaElement.value = aString; } @end From 9a051f9c248ec848595de581cffd6f31acadfd85 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Thu, 4 Nov 2010 19:18:27 +0800 Subject: [PATCH 08/13] fixes minor typo in LPChartView --- LPChartView.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LPChartView.j b/LPChartView.j index 03ee889..f0a2d35 100644 --- a/LPChartView.j +++ b/LPChartView.j @@ -233,7 +233,7 @@ var labelViewHeight = 20, if (_maxValuePosition !== 1.0) drawViewSize.height -= maxValueHeightDelta; - // Make sure we don't do unnecessary word + // Make sure we don't do unnecessary work if (_currentSize && CGSizeEqualToSize(_currentSize, drawViewSize)) return _framesSet; From a452b451d3857caec936cf9f41019b5e9062d55d Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Fri, 5 Nov 2010 18:18:35 +0800 Subject: [PATCH 09/13] In LPCalendarHeaderView, removes the necessity to resize the month label every time a new string is assigned by using correct autoresizing masks and alignment theme attributes --- LPCalendarHeaderView.j | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LPCalendarHeaderView.j b/LPCalendarHeaderView.j index 465d4a2..f95a0b9 100644 --- a/LPCalendarHeaderView.j +++ b/LPCalendarHeaderView.j @@ -56,8 +56,9 @@ var LPMonthNames = [@"January", @"February", @"March", @"April", @"May", @"June" { if(self = [super initWithFrame:aFrame]) { - monthLabel = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; - [monthLabel setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin]; + monthLabel = [[CPTextField alloc] initWithFrame:CGRectMake(0, 8, aFrame.size.width, 32)]; + [monthLabel setAutoresizingMask:CPViewMaxYMargin | CPViewWidthSizable]; + [monthLabel setValue:CPCenterTextAlignment forThemeAttribute:@"alignment"]; [self addSubview:monthLabel]; prevButton = [[LPCalendarHeaderArrowButton alloc] initWithFrame:CGRectMake(6, 9, 0, 0)]; @@ -91,8 +92,7 @@ var LPMonthNames = [@"January", @"February", @"March", @"April", @"May", @"June" representedDate = [aDate copy]; [monthLabel setStringValue:[CPString stringWithFormat:@"%s %i", LPMonthNames[representedDate.getUTCMonth()], representedDate.getUTCFullYear()]]; - [monthLabel sizeToFit]; - [monthLabel setCenter:CGPointMake(CGRectGetMidX([self bounds]), 16)]; + } - (void)setWeekStartsOnMonday:(BOOL)shouldWeekStartOnMonday From b3b094fe481bcfc1b87f365f9291d4e8fc9ea7f6 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Fri, 5 Nov 2010 22:57:59 +0800 Subject: [PATCH 10/13] in LPCalendarView, revises the handling and drawing of tiles and introduce a new bezel view, bezel inset theme attribute. also revises drawing of grids and grid shadows, rewrites drawRect: of the month view --- LPCalendarMonthView.j | 41 ++++++++++++++++++++++++++--------------- LPCalendarView.j | 24 ++++++++++++++++++++---- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/LPCalendarMonthView.j b/LPCalendarMonthView.j index 91e0bee..0cfef69 100644 --- a/LPCalendarMonthView.j +++ b/LPCalendarMonthView.j @@ -293,7 +293,7 @@ var _startAndEndOfWeekCache = {}; for (var dayIndex = 0; dayIndex < 7; dayIndex++) { // CGRectInset() mucks up the frame for some reason. - var tileFrame = CGRectMake((dayIndex * tileSize.width) + dayIndex, weekIndex * tileSize.height, tileSize.width, tileSize.height -1); + var tileFrame = CGRectMake((dayIndex * tileSize.width), weekIndex * tileSize.height, tileSize.width, tileSize.height); [tiles[tileIndex] setFrame:tileFrame]; tileIndex += 1; @@ -464,23 +464,34 @@ var _startAndEndOfWeekCache = {}; end:(anEndIndex > -1) ? [[tiles objectAtIndex:anEndIndex] date] : nil]; } -- (void)drawRect:(CGRect)aRect -{ - var context = [[CPGraphicsContext currentContext] graphicsPort], - bounds = [self bounds], - width = CGRectGetWidth(bounds), - height = CGRectGetHeight(bounds), - tileSize = [self tileSize]; +- (void) drawRect:(CGRect)aRect { + + var context = [[CPGraphicsContext currentContext] graphicsPort], + bounds = [self bounds], + width = CGRectGetWidth(bounds), + height = CGRectGetHeight(bounds), + tileSize = [self tileSize]; + + var hLine = function (inMarginTop) { + + CGContextFillRect(context, CGRectMake(0, inMarginTop, width, 1)); + + }, + + vLine = function (inMarginLeft) { + + CGContextFillRect(context, CGRectMake(inMarginLeft, 0, 1, height)); + + }; - CGContextSetFillColor(context, [calendarView currentValueForThemeAttribute:@"grid-color"]); + CGContextSetFillColor(context, [calendarView currentValueForThemeAttribute:@"grid-shadow-color"]); + for (var i = 1; i < 6; i++) hLine(tileSize.height * i - 1); + for (var i = 1; i < 7; i++) vLine(tileSize.width * i - 1); - // Horizontal lines - for (var i = 1; i < 6; i++) - CGContextFillRect(context, CGRectMake(0, i * tileSize.height - 1, width, 1)); + CGContextSetFillColor(context, [calendarView currentValueForThemeAttribute:@"grid-color"]); + for (var i = 1; i < 6; i++) hLine(tileSize.height * i); + for (var i = 1; i < 7; i++) vLine(tileSize.width * i); - // Vertical lines - for (var i = 0; i < 7; i++) - CGContextFillRect(context, CGRectMake((i - 1) + (i * tileSize.width), 0, 1, height)); } @end diff --git a/LPCalendarView.j b/LPCalendarView.j index f322a6b..d7ab07e 100644 --- a/LPCalendarView.j +++ b/LPCalendarView.j @@ -56,8 +56,8 @@ + (id)themeAttributes { - return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], CGSizeMake(0,0), [CPNull null], [CPNull null], 40, [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], 30, [CPNull null], [CPNull null], [CPNull null], [CPNull null]] - forKeys:[@"background-color", @"grid-color", + return [CPDictionary dictionaryWithObjects:[[CPNull null], CGInsetMakeZero(), [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], CGSizeMake(0,0), [CPNull null], [CPNull null], 40, [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], [CPNull null], 30, [CPNull null], [CPNull null], [CPNull null], [CPNull null]] + forKeys:[@"bezel-color", @"bezel-inset", @"grid-color", @"grid-shadow-color", @"tile-size", @"tile-font", @"tile-text-color", @"tile-text-shadow-color", @"tile-text-shadow-offset", @"tile-bezel-color", @"header-button-offset", @"header-prev-button-image", @"header-next-button-image", @"header-height", @"header-background-color", @"header-font", @"header-text-color", @"header-text-shadow-color", @"header-text-shadow-offset", @"header-alignment", @"header-weekday-offset", @"header-weekday-label-font", @"header-weekday-label-color", @"header-weekday-label-shadow-color", @"header-weekday-label-shadow-offset"]]; @@ -87,6 +87,10 @@ [slideView setAnimationDuration:0.2]; [self addSubview:slideView]; + bezelView = [[CPView alloc] initWithFrame:[slideView frame]]; + [bezelView setHitTests:NO]; + [self addSubview:bezelView positioned:CPWindowBelow relativeTo:nil]; + firstMonthView = [[LPCalendarMonthView alloc] initWithFrame:[slideView bounds] calendarView:self]; [firstMonthView setDelegate:self]; [slideView addSubview:firstMonthView]; @@ -199,8 +203,20 @@ [headerView setFrameSize:CGSizeMake(width, headerHeight)]; [slideView setFrame:CGRectMake(0, headerHeight, width, CGRectGetHeight([self bounds]) - headerHeight)]; - - [slideView setBackgroundColor:[self currentValueForThemeAttribute:@"background-color"]]; + + [bezelView setBackgroundColor:[self currentValueForThemeAttribute:@"bezel-color"]]; + var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"]; + + var slideFrame = [slideView frame]; + [bezelView setFrame:CGRectMake( + + slideFrame.origin.x + bezelInset.left, + slideFrame.origin.y + bezelInset.top, + slideFrame.size.width - bezelInset.left - bezelInset.right, + slideFrame.size.height - bezelInset.top - bezelInset.bottom + + )]; + } - (void)didClickPrevButton:(id)sender From 6a5c41105d983e6c5b974678d3f57fe540b2e865 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Tue, 9 Nov 2010 00:05:25 +0800 Subject: [PATCH 11/13] more bezel view changes to LPCalendarView --- LPCalendarView.j | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/LPCalendarView.j b/LPCalendarView.j index d7ab07e..57d11bc 100644 --- a/LPCalendarView.j +++ b/LPCalendarView.j @@ -71,6 +71,7 @@ fullSelection = [nil, nil]; var bounds = [self bounds]; + [self setClipsToBounds:NO]; headerView = [[LPCalendarHeaderView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(bounds), 40)]; [[headerView prevButton] setTarget:self]; @@ -207,16 +208,16 @@ [bezelView setBackgroundColor:[self currentValueForThemeAttribute:@"bezel-color"]]; var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"]; - var slideFrame = [slideView frame]; + var viewFrame = [self frame]; [bezelView setFrame:CGRectMake( - slideFrame.origin.x + bezelInset.left, - slideFrame.origin.y + bezelInset.top, - slideFrame.size.width - bezelInset.left - bezelInset.right, - slideFrame.size.height - bezelInset.top - bezelInset.bottom + 0 + bezelInset.left, + 0 + bezelInset.top, + viewFrame.size.width - bezelInset.left - bezelInset.right, + viewFrame.size.height - bezelInset.top - bezelInset.bottom )]; - + } - (void)didClickPrevButton:(id)sender From cebee7d7fc79ae096e47d5d25eec36b7bea05d18 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Wed, 10 Nov 2010 13:28:25 +0800 Subject: [PATCH 12/13] =?UTF-8?q?revises=20the=20month=20label=20within=20?= =?UTF-8?q?the=20calendar=E2=80=99s=20header=20view=20to=20be=20of=20the?= =?UTF-8?q?=20same=20height=20of=20its=20enclosing=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LPCalendarHeaderView.j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LPCalendarHeaderView.j b/LPCalendarHeaderView.j index f95a0b9..feee0ae 100644 --- a/LPCalendarHeaderView.j +++ b/LPCalendarHeaderView.j @@ -56,8 +56,8 @@ var LPMonthNames = [@"January", @"February", @"March", @"April", @"May", @"June" { if(self = [super initWithFrame:aFrame]) { - monthLabel = [[CPTextField alloc] initWithFrame:CGRectMake(0, 8, aFrame.size.width, 32)]; - [monthLabel setAutoresizingMask:CPViewMaxYMargin | CPViewWidthSizable]; + monthLabel = [[CPTextField alloc] initWithFrame:CGRectMake(0, 8, aFrame.size.width, aFrame.size.height)]; + [monthLabel setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; [monthLabel setValue:CPCenterTextAlignment forThemeAttribute:@"alignment"]; [self addSubview:monthLabel]; From 3f144a5a877bf0e48bc7978681d50490afa78118 Mon Sep 17 00:00:00 2001 From: Evadne Wu Date: Wed, 10 Nov 2010 14:59:45 +0800 Subject: [PATCH 13/13] =?UTF-8?q?sets=20the=20month=20label=20of=20the=20c?= =?UTF-8?q?alendar=E2=80=99s=20header=20view=20to=20not=20hittest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LPCalendarHeaderView.j | 1 + 1 file changed, 1 insertion(+) diff --git a/LPCalendarHeaderView.j b/LPCalendarHeaderView.j index feee0ae..ecca1d3 100644 --- a/LPCalendarHeaderView.j +++ b/LPCalendarHeaderView.j @@ -59,6 +59,7 @@ var LPMonthNames = [@"January", @"February", @"March", @"April", @"May", @"June" monthLabel = [[CPTextField alloc] initWithFrame:CGRectMake(0, 8, aFrame.size.width, aFrame.size.height)]; [monthLabel setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; [monthLabel setValue:CPCenterTextAlignment forThemeAttribute:@"alignment"]; + [monthLabel setHitTests:NO]; [self addSubview:monthLabel]; prevButton = [[LPCalendarHeaderArrowButton alloc] initWithFrame:CGRectMake(6, 9, 0, 0)];