From d1a80793aab82ebe7d81491be6dd59398fb61ab7 Mon Sep 17 00:00:00 2001 From: Eddie Ehlin Date: Wed, 6 Feb 2013 22:59:40 +0100 Subject: BeanCollectionExtractionView's beans tableview now drops a shadow. The note textview is also scaled to fill the width of the screen, just as the table view. --- iBean/iBean.xcodeproj/project.pbxproj | 10 ++++++ .../UserInterfaceState.xcuserstate | Bin 66883 -> 50262 bytes .../xcdebugger/Breakpoints.xcbkptlist | 13 ++++++++ iBean/iBean/BeanCell.m | 2 +- iBean/iBean/BeanCollectionExtractionScrollView.m | 4 +-- .../iBean/BeanCollectionExtractionViewController.m | 14 ++++++-- iBean/iBean/UITableView+Extra.h | 15 +++++++++ iBean/iBean/UITableView+Extra.m | 36 +++++++++++++++++++++ iBean/iBean/iPhoneStoryboard.storyboard | 14 ++++---- 9 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 iBean/iBean/UITableView+Extra.h create mode 100644 iBean/iBean/UITableView+Extra.m diff --git a/iBean/iBean.xcodeproj/project.pbxproj b/iBean/iBean.xcodeproj/project.pbxproj index 64c42d5..72a51e6 100644 --- a/iBean/iBean.xcodeproj/project.pbxproj +++ b/iBean/iBean.xcodeproj/project.pbxproj @@ -33,6 +33,8 @@ 020C569C16A49C8300D8224C /* Configuration+Interface.m in Sources */ = {isa = PBXBuildFile; fileRef = 020C569B16A49C8300D8224C /* Configuration+Interface.m */; }; 022A9C6B16BE9CA300DB3A4A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 022A9C6A16BE9CA300DB3A4A /* AudioToolbox.framework */; }; 024CB02016C04BD5009CBC15 /* UIColor+Extra.m in Sources */ = {isa = PBXBuildFile; fileRef = 024CB01F16C04BD5009CBC15 /* UIColor+Extra.m */; }; + 024CB03716C2EF10009CBC15 /* UITableView+Extra.m in Sources */ = {isa = PBXBuildFile; fileRef = 024CB03616C2EF10009CBC15 /* UITableView+Extra.m */; }; + 024CB03916C2EFD5009CBC15 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 024CB03816C2EFD5009CBC15 /* QuartzCore.framework */; }; 024F676D16A4A61D004A1201 /* InstantExtractionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 024F676C16A4A61D004A1201 /* InstantExtractionViewController.m */; }; 0276253916B58D6000EE2F4E /* SettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0276253816B58D6000EE2F4E /* SettingsViewController.m */; }; 0276253C16B59E4C00EE2F4E /* Configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = 0276253B16B59E4C00EE2F4E /* Configuration.m */; }; @@ -89,6 +91,9 @@ 022A9C6A16BE9CA300DB3A4A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 024CB01E16C04BD5009CBC15 /* UIColor+Extra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Extra.h"; sourceTree = ""; }; 024CB01F16C04BD5009CBC15 /* UIColor+Extra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Extra.m"; sourceTree = ""; }; + 024CB03516C2EF10009CBC15 /* UITableView+Extra.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+Extra.h"; sourceTree = ""; }; + 024CB03616C2EF10009CBC15 /* UITableView+Extra.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+Extra.m"; sourceTree = ""; }; + 024CB03816C2EFD5009CBC15 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 024F676B16A4A61D004A1201 /* InstantExtractionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstantExtractionViewController.h; sourceTree = ""; }; 024F676C16A4A61D004A1201 /* InstantExtractionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstantExtractionViewController.m; sourceTree = ""; }; 0276253716B58D6000EE2F4E /* SettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsViewController.h; sourceTree = ""; }; @@ -116,6 +121,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 024CB03916C2EFD5009CBC15 /* QuartzCore.framework in Frameworks */, 022A9C6B16BE9CA300DB3A4A /* AudioToolbox.framework in Frameworks */, 020C55981691014E00D8224C /* UIKit.framework in Frameworks */, 020C559A1691014E00D8224C /* Foundation.framework in Frameworks */, @@ -147,6 +153,7 @@ 020C55961691014E00D8224C /* Frameworks */ = { isa = PBXGroup; children = ( + 024CB03816C2EFD5009CBC15 /* QuartzCore.framework */, 022A9C6A16BE9CA300DB3A4A /* AudioToolbox.framework */, 020C55971691014E00D8224C /* UIKit.framework */, 020C55991691014E00D8224C /* Foundation.framework */, @@ -301,6 +308,8 @@ children = ( 024CB01E16C04BD5009CBC15 /* UIColor+Extra.h */, 024CB01F16C04BD5009CBC15 /* UIColor+Extra.m */, + 024CB03516C2EF10009CBC15 /* UITableView+Extra.h */, + 024CB03616C2EF10009CBC15 /* UITableView+Extra.m */, ); name = Categories; sourceTree = ""; @@ -432,6 +441,7 @@ 0276254516B5AACF00EE2F4E /* ThresholdViewController.m in Sources */, 0276254816B5BC5300EE2F4E /* ThresholdCell.m in Sources */, 024CB02016C04BD5009CBC15 /* UIColor+Extra.m in Sources */, + 024CB03716C2EF10009CBC15 /* UITableView+Extra.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate index 5e4e5cb..c07ccef 100644 Binary files a/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate and b/iBean/iBean.xcodeproj/project.xcworkspace/xcuserdata/eddiex.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist index 6e8321f..eb98d15 100644 --- a/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist +++ b/iBean/iBean.xcodeproj/xcuserdata/eddiex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -133,5 +133,18 @@ landmarkName = "-processThresholds" landmarkType = "5"> + + diff --git a/iBean/iBean/BeanCell.m b/iBean/iBean/BeanCell.m index cc5f663..0cc2f0e 100644 --- a/iBean/iBean/BeanCell.m +++ b/iBean/iBean/BeanCell.m @@ -29,7 +29,7 @@ - (void) initWithNameGrindSettingAndAmount: (NSString*) name: (NSNumber*)grindSetting: (NSNumber*) amount { self.beanNameLabel.text = name; - self.beanGrindSettingLabel.text = [NSString stringWithFormat:@"%@", grindSetting]; + self.beanGrindSettingLabel.text = [NSString stringWithFormat:@"Grind @ %@", grindSetting]; self.beanAmountLabel.text = [NSString stringWithFormat:@"%1.1f g", [amount doubleValue]]; } diff --git a/iBean/iBean/BeanCollectionExtractionScrollView.m b/iBean/iBean/BeanCollectionExtractionScrollView.m index 5a7b024..682f525 100644 --- a/iBean/iBean/BeanCollectionExtractionScrollView.m +++ b/iBean/iBean/BeanCollectionExtractionScrollView.m @@ -26,9 +26,9 @@ //Resize the UITableView containing all the beans UITableView *bt = [self.subviews objectAtIndex:0]; //1 - Set the height of the table cells - [bt setRowHeight:60.0f]; + [bt setRowHeight:60.0f]; //2 - Calculate the total height for the tableview (i.e.: numberOfRows*rowHeight) - bt.frame = CGRectMake(bt.frame.origin.x, bt.frame.origin.y, bt.frame.size.width, [bt numberOfRowsInSection:0]*bt.rowHeight); + bt.frame = CGRectMake(bt.frame.origin.x, bt.frame.origin.y, bt.frame.size.width, ([bt numberOfRowsInSection:0]*bt.rowHeight)+bt.tableFooterView.bounds.size.height); //Move down the note text view, so that it don't overlaps the table. UITextView *note = [self.subviews objectAtIndex:1]; diff --git a/iBean/iBean/BeanCollectionExtractionViewController.m b/iBean/iBean/BeanCollectionExtractionViewController.m index 633c44a..7ac982f 100644 --- a/iBean/iBean/BeanCollectionExtractionViewController.m +++ b/iBean/iBean/BeanCollectionExtractionViewController.m @@ -5,7 +5,6 @@ // Created by Eddie Ehlin on 2013-01-18. // Copyright (c) 2013 Eddie Ehlin. All rights reserved. // - #import #import "BeanCollectionExtractionViewController.h" #import "BeanCollectionInfoViewController.h" @@ -13,6 +12,7 @@ #import "BeanCell.h" #import "Bean+Interface.h" #import "AppDelegate+Storage.h" +#import "UITableView+Extra.h" @interface BeanCollectionExtractionViewController () @@ -33,7 +33,7 @@ { [super viewDidLoad]; // Do any additional setup after loading the view. - + //[self.beanCollectionNoteTextView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed: @"textview-bg.png"]]]; } - (void) viewWillDisappear:(BOOL)animated @@ -187,6 +187,16 @@ return cell; } +- (UIView*) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section +{ + //Add shadow to the bottom of the bean table view. + return [UITableView bottomShadowForTableView:self.beanTableView]; +} + +-(CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ + return 10.0f; +} + #pragma mark - UIAlertView delegate - (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { diff --git a/iBean/iBean/UITableView+Extra.h b/iBean/iBean/UITableView+Extra.h new file mode 100644 index 0000000..2eb8bc3 --- /dev/null +++ b/iBean/iBean/UITableView+Extra.h @@ -0,0 +1,15 @@ +// +// UITableView+Extra.h +// iBean +// +// Created by Eddie Ehlin on 2013-02-06. +// Copyright (c) 2013 Eddie Ehlin. All rights reserved. +// + +#import + +@interface UITableView (Extra) + ++ (UIView*)bottomShadowForTableView:(UITableView*) tableView; + +@end diff --git a/iBean/iBean/UITableView+Extra.m b/iBean/iBean/UITableView+Extra.m new file mode 100644 index 0000000..54195ac --- /dev/null +++ b/iBean/iBean/UITableView+Extra.m @@ -0,0 +1,36 @@ +// +// UITableView+Extra.m +// iBean +// +// Created by Eddie Ehlin on 2013-02-06. +// Copyright (c) 2013 Eddie Ehlin. All rights reserved. +// + +#import "UITableView+Extra.h" +#import + +@implementation UITableView (Extra) + ++ (UIView*) bottomShadowForTableView:(UITableView *)tableView +{ + UIView *shadowView = nil; + + if (tableView != nil) + { + UIColor *blackColor = [[UIColor blackColor] colorWithAlphaComponent:0.6f]; + UIColor *lightColor = [UIColor clearColor]; + NSInteger shadowHeight = 10; + + shadowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, shadowHeight)]; + shadowView.alpha = 0.6f; + + CAGradientLayer *shadowGradient = [[CAGradientLayer alloc] init]; + shadowGradient.frame = CGRectMake(0,0, tableView.frame.size.width, shadowHeight); + shadowGradient.colors = [NSArray arrayWithObjects:(id)[blackColor CGColor], (id)[lightColor CGColor], nil]; + + [shadowView.layer addSublayer:shadowGradient]; + } + return shadowView; +} + +@end diff --git a/iBean/iBean/iPhoneStoryboard.storyboard b/iBean/iBean/iPhoneStoryboard.storyboard index a4b3309..18bb04e 100644 --- a/iBean/iBean/iPhoneStoryboard.storyboard +++ b/iBean/iBean/iPhoneStoryboard.storyboard @@ -1065,6 +1065,7 @@ + @@ -1140,23 +1141,23 @@ - - + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - + - - + + + + -