From d42290339faf743ffc226bbd410c70e5291d3341 Mon Sep 17 00:00:00 2001 From: Benson Peng Date: Sat, 5 Nov 2011 11:01:37 +0800 Subject: [PATCH] finish comment integration --- .../Controller/CommentTableViewCell.m | 2 + .../Controller/CommentTableViewCell.xib | 111 ++++------- .../Controller/ProductCommentsController.m | 14 +- .../Controller/ProductCommentsController.xib | 15 +- .../Controller/ProductDetailController.m | 45 +++++ .../ProductWriteCommentController.m | 5 +- .../ProductWriteCommentController.xib | 102 ++++++++--- .../Controller/SearchProductController.m | 9 +- .../Controller/SearchProductController.xib | 173 +----------------- .../Controller/Utils/GroupBuyControllerExt.h | 1 + .../Controller/Utils/GroupBuyControllerExt.m | 11 ++ Location/MapViewUtil.m | 5 +- 12 files changed, 192 insertions(+), 301 deletions(-) diff --git a/GroupBuyCommon/Controller/CommentTableViewCell.m b/GroupBuyCommon/Controller/CommentTableViewCell.m index c5967db..6e9336d 100644 --- a/GroupBuyCommon/Controller/CommentTableViewCell.m +++ b/GroupBuyCommon/Controller/CommentTableViewCell.m @@ -75,6 +75,8 @@ + (CommentTableViewCell *)createCell - (void)setCellInfoWithContent:(NSString *)content nickName:(NSString *)nickName createDate:(NSDate *)createDate { + self.selectionStyle = UITableViewCellSelectionStyleNone; + self.nickNameLabel.text = nickName; self.createDateLabel.text = [self getDateDisplayText:createDate]; diff --git a/GroupBuyCommon/Controller/CommentTableViewCell.xib b/GroupBuyCommon/Controller/CommentTableViewCell.xib index adafc46..3972000 100644 --- a/GroupBuyCommon/Controller/CommentTableViewCell.xib +++ b/GroupBuyCommon/Controller/CommentTableViewCell.xib @@ -1,14 +1,14 @@ - 1056 + 1280 10K549 - 1305 + 1938 1038.36 461.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 300 + 933 YES @@ -49,7 +49,6 @@ 292 {{160, 10}, {140, 21}} - NO YES @@ -57,27 +56,32 @@ NO IBCocoaTouchFramework Date - - Helvetica - 11 - 16 - 1 - MCAwLjI1MDk4MDQwNyAwLjUwMTk2MDgxNAA + MC40MzUyOTQxMTc2IDAuNDA3ODQzMTM3MyAwLjM2ODYyNzQ1MQA 1 10 1000 2 + + Helvetica + Helvetica + 0 + 11 + + + Helvetica + 11 + 16 + 292 {{10, 10}, {150, 21}} - NO YES @@ -85,25 +89,30 @@ NO IBCocoaTouchFramework name - - Helvetica - 15 - 16 - 1 - MCAwLjI1MDk4MDQwNyAwLjUwMTk2MDgxNAA + MC40MzUyOTQxMTc2IDAuNDA3ODQzMTM3MyAwLjM2ODYyNzQ1MQA 1 10 + + Helvetica + Helvetica + 0 + 15 + + + Helvetica + 15 + 16 + 292 {{10, 39}, {283, 65}} - NO YES @@ -111,20 +120,20 @@ NO IBCocoaTouchFramework content - 1 - MCAwIDAAA + MC43NDUwOTgwMzkyIDAuNzIxNTY4NjI3NSAwLjY4NjI3NDUwOTgAA 1 10 1000 + + - {320, 114} + {320, 113} - 3 @@ -139,7 +148,6 @@ {320, 114} - IBCocoaTouchFramework @@ -260,60 +268,9 @@ - 13 - - - - YES - - CommentTableViewCell - UITableViewCell - - YES - - YES - contentLabel - createDateLabel - nickNameLabel - - - YES - UILabel - UILabel - UILabel - - - - YES - - YES - contentLabel - createDateLabel - nickNameLabel - - - YES - - contentLabel - UILabel - - - createDateLabel - UILabel - - - nickNameLabel - UILabel - - - - - IBProjectSource - ./Classes/CommentTableViewCell.h - - - + 15 + 0 IBCocoaTouchFramework @@ -322,6 +279,6 @@ YES 3 - 300 + 933 diff --git a/GroupBuyCommon/Controller/ProductCommentsController.m b/GroupBuyCommon/Controller/ProductCommentsController.m index 3d9662a..7b5aa62 100644 --- a/GroupBuyCommon/Controller/ProductCommentsController.m +++ b/GroupBuyCommon/Controller/ProductCommentsController.m @@ -11,7 +11,7 @@ #import "GroupBuyNetworkConstants.h" #import "TimeUtils.h" #import "CommentTableViewCell.h" - +#import "GroupBuyControllerExt.h" @implementation ProductCommentsController @@ -44,17 +44,19 @@ - (void)didReceiveMemoryWarning - (void)viewDidLoad { // [self setBackgroundImageName:@"background.png"]; + [self setBackgroundImageName:@"background.png"]; + self.dataTableView.backgroundColor = [UIColor clearColor]; + self.dataTableView.frame = CGRectMake(8, 8, 304, 480-44-20-8-55-5); supportRefreshHeader = YES; [super viewDidLoad]; // Do any additional setup after loading the view from its nib. self.navigationItem.title = @"所有评论"; + + [self setGroupBuyNavigationBackButton]; + [self setGroupBuyNavigationRightButton:@"撰写评论" action:@selector(writeComment)]; + [self setGroupBuyNavigationTitle:self.navigationItem.title]; - UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(writeComment)]; - self.navigationItem.rightBarButtonItem = rightItem; - [rightItem release]; - - [self setNavigationLeftButton:@"返回" action:@selector(clickBack:)]; //[GlobalGetProductService() getCommentsWithProductId:productId viewController:self]; } diff --git a/GroupBuyCommon/Controller/ProductCommentsController.xib b/GroupBuyCommon/Controller/ProductCommentsController.xib index c89c3ab..5f0fba3 100644 --- a/GroupBuyCommon/Controller/ProductCommentsController.xib +++ b/GroupBuyCommon/Controller/ProductCommentsController.xib @@ -1,14 +1,14 @@ - 1056 + 1280 10K549 - 1305 + 1938 1038.36 461.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 300 + 933 YES @@ -42,17 +42,18 @@ 274 - {320, 367} + {{0, 14}, {320, 353}} - + 3 - MQA + MCAwAA YES IBCocoaTouchFramework YES 1 + 0 YES 44 @@ -219,6 +220,6 @@ YES 3 - 300 + 933 diff --git a/GroupBuyCommon/Controller/ProductDetailController.m b/GroupBuyCommon/Controller/ProductDetailController.m index 4fbcfe2..7202463 100644 --- a/GroupBuyCommon/Controller/ProductDetailController.m +++ b/GroupBuyCommon/Controller/ProductDetailController.m @@ -629,11 +629,17 @@ - (void)handleForwardProduct:(NSInteger)buttonIndex switch (buttonIndex) { case BUTTON_SEND_BY_SMS: + { + GlobalSetNavBarBackground(nil); [self sendSms:@"" body:smsBody]; + } break; case BUTTON_SEND_BY_EMAIL: + { + GlobalSetNavBarBackground(nil); [self sendEmailTo:nil ccRecipients:nil bccRecipients:nil subject:subject body:htmlBody isHTML:NO delegate:self]; + } break; default: @@ -651,4 +657,43 @@ - (void)clickTaobaoSearch:(id)sender [TaobaoSearchController showController:self text:product.title price:[product.price doubleValue] value:[product.value doubleValue]]; } +- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result +{ + NSLog(@" result=%d", result); + GlobalSetNavBarBackground(@"navigationbar.png"); + [self dismissModalViewControllerAnimated:YES]; + +} + +- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error +{ + NSString* text = nil; + + // Notifies users about errors associated with the interface + switch (result) + { + case MFMailComposeResultCancelled: + text = @" Result: canceled"; + break; + case MFMailComposeResultSaved: + text = @" Result: saved"; + break; + case MFMailComposeResultSent: + text = @" Result: sent"; + break; + case MFMailComposeResultFailed: + text = @" Result: failed"; + break; + default: + text = @" Result: not sent"; + break; + } + + NSLog(@"%@", text); + GlobalSetNavBarBackground(@"navigationbar.png"); + [self dismissModalViewControllerAnimated:YES]; + +} + + @end diff --git a/GroupBuyCommon/Controller/ProductWriteCommentController.m b/GroupBuyCommon/Controller/ProductWriteCommentController.m index 7b89cb0..793408f 100644 --- a/GroupBuyCommon/Controller/ProductWriteCommentController.m +++ b/GroupBuyCommon/Controller/ProductWriteCommentController.m @@ -48,8 +48,9 @@ - (void)viewDidLoad // Do any additional setup after loading the view from its nib. self.navigationItem.title = @"撰写评论"; - [self setNavigationRightButton:@"提交" action:@selector(submit)]; - [self setNavigationLeftButton:@"返回" action:@selector(clickBack:)]; + [self setGroupBuyNavigationBackButton]; + [self setGroupBuyNavigationRightButton:@"提交" action:@selector(submit)]; + [self setGroupBuyNavigationTitle:self.navigationItem.title]; [self.contentTextView setRoundRectStyle]; groupbuyAppDelegate *delegate = (groupbuyAppDelegate *)[UIApplication sharedApplication].delegate; diff --git a/GroupBuyCommon/Controller/ProductWriteCommentController.xib b/GroupBuyCommon/Controller/ProductWriteCommentController.xib index 3b16023..0794803 100644 --- a/GroupBuyCommon/Controller/ProductWriteCommentController.xib +++ b/GroupBuyCommon/Controller/ProductWriteCommentController.xib @@ -1,19 +1,20 @@ - 1056 + 1280 10K549 - 1305 + 1938 1038.36 461.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 300 + 933 YES IBUITextField IBUITextView + IBUIImageView IBUIView IBUILabel IBProxyObject @@ -41,6 +42,20 @@ 274 YES + + + 292 + {320, 367} + + + + NO + IBCocoaTouchFramework + + NSImage + background@2x.png + + 292 @@ -54,18 +69,24 @@ NO IBCocoaTouchFramework 昵称 - - STHeitiSC-Light - 14 - 16 - - + 1 - MCAwIDAAA + MC40MzUyOTQxMTc2IDAuNDA3ODQzMTM3MyAwLjM2ODYyNzQ1MQA 1 10 + + STHeitiSC-Medium + Heiti SC + 2 + 14 + + + STHeitiSC-Medium + 14 + 16 + @@ -80,11 +101,15 @@ NO IBCocoaTouchFramework 评论 - - + + 1 + MC40MzUyOTQxMTc2IDAuNDA3ODQzMTM3MyAwLjM2ODYyNzQ1MQA + 1 10 + + @@ -99,23 +124,27 @@ 0 3 + 请输入你的昵称 - 3 - MAA - - 2 - - - - Helvetica - 14 - 16 + 1 + MC43NDUwOTgwMzkyIDAuNzIxNTY4NjI3NSAwLjY4NjI3NDUwOTgAA YES 17 IBCocoaTouchFramework + + Helvetica + Helvetica + 0 + 14 + + + Helvetica + 14 + 16 + @@ -132,21 +161,28 @@ YES IBCocoaTouchFramework - + + 1 + MC43NDUwOTgwMzkyIDAuNzIxNTY4NjI3NSAwLjY4NjI3NDUwOTgAA + 2 IBCocoaTouchFramework + + {{0, 64}, {320, 367}} - + 3 MQA - + + 2 + @@ -204,6 +240,7 @@ + @@ -238,6 +275,11 @@ + + 16 + + + @@ -250,6 +292,7 @@ -2.IBPluginDependency 1.IBPluginDependency 15.IBPluginDependency + 16.IBPluginDependency 4.IBPluginDependency 5.IBPluginDependency 6.IBPluginDependency @@ -265,6 +308,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -279,7 +323,7 @@ - 15 + 16 @@ -342,6 +386,10 @@ YES 3 - 300 + + background@2x.png + {639, 734} + + 933 diff --git a/GroupBuyCommon/Controller/SearchProductController.m b/GroupBuyCommon/Controller/SearchProductController.m index 1e82056..d1fc8a3 100644 --- a/GroupBuyCommon/Controller/SearchProductController.m +++ b/GroupBuyCommon/Controller/SearchProductController.m @@ -14,6 +14,7 @@ #import "HotKeyword.h" #import "HotKeywordManager.h" #import "ProductManager.h" +#import "UIImageUtil.h" //private methods @interface SearchProductController() @@ -78,16 +79,12 @@ - (void)viewDidLoad [self setGroupBuyNavigationTitle:self.tabBarItem.title]; [super viewDidLoad]; - -// UIImage* buttonImage = [[UIImage imageNamed:@"tu_188.png"] stretchableImageWithLeftCapWidth:1 -// topCapHeight:0]; -// [self.searchButton setBackgroundImage:buttonImage forState:UIControlStateNormal]; - UIImage* searchTextFieldImage = [[UIImage imageNamed:@"tu_46-18.png"] stretchableImageWithLeftCapWidth:57/2 topCapHeight:0]; + UIImage* searchTextFieldImage = [UIImage strectchableImageName:@"tu_46-18.png"]; [self.searchTextFieldBackgroundView setImage:searchTextFieldImage]; // set search button background - UIImage* buttonBgImage = [[UIImage imageNamed:@"tu_48.png"] stretchableImageWithLeftCapWidth:23 topCapHeight:0]; + UIImage* buttonBgImage = [UIImage strectchableImageName:@"tu_48.png"]; [searchButton setBackgroundImage:buttonBgImage forState:UIControlStateNormal]; // [self setNavigationRightButton:@"语音搜索" action:@selector(speechSearch:)]; diff --git a/GroupBuyCommon/Controller/SearchProductController.xib b/GroupBuyCommon/Controller/SearchProductController.xib index 4c65d5b..da29aac 100644 --- a/GroupBuyCommon/Controller/SearchProductController.xib +++ b/GroupBuyCommon/Controller/SearchProductController.xib @@ -48,7 +48,6 @@ 292 {{20, 195}, {72, 37}} - NO 10 @@ -84,7 +83,6 @@ 292 {{115, 195}, {72, 37}} - NO 11 @@ -102,7 +100,6 @@ 292 {{211, 195}, {72, 37}} - NO 12 @@ -120,7 +117,6 @@ 292 {{20, 229}, {72, 37}} - NO 13 @@ -138,7 +134,6 @@ 292 {{115, 229}, {72, 37}} - NO 14 @@ -156,7 +151,6 @@ 292 {{211, 229}, {85, 37}} - NO 15 @@ -174,7 +168,6 @@ 292 {{20, 99}, {88, 37}} - NO IBCocoaTouchFramework @@ -194,7 +187,6 @@ 292 {{115, 99}, {88, 37}} - NO IBCocoaTouchFramework @@ -211,7 +203,6 @@ 292 {{211, 99}, {72, 37}} - NO IBCocoaTouchFramework @@ -228,7 +219,6 @@ 292 {{20, 267}, {72, 37}} - NO 16 @@ -246,7 +236,6 @@ 292 {{115, 267}, {72, 37}} - NO 17 @@ -264,7 +253,6 @@ 292 {{211, 267}, {72, 37}} - NO 18 @@ -282,7 +270,6 @@ 292 {{20, 64}, {68, 21}} - NO YES @@ -314,7 +301,6 @@ 292 {{20, 157}, {68, 21}} - 3 @@ -341,8 +327,6 @@ 290 {{0, 313}, {320, 44}} - - 3 IBCocoaTouchFramework 请输入搜索关键字 @@ -361,7 +345,6 @@ 292 {{7, 9}, {306, 42}} - NO IBCocoaTouchFramework @@ -375,7 +358,6 @@ 292 {{15, 15}, {226, 29}} - NO IBCocoaTouchFramework @@ -385,7 +367,6 @@ 292 {{241, 15}, {63, 29}} - NO IBCocoaTouchFramework @@ -410,7 +391,6 @@ 292 {{10, 92}, {300, 2}} - NO IBCocoaTouchFramework @@ -424,7 +404,6 @@ 292 {{10, 189}, {300, 2}} - NO IBCocoaTouchFramework @@ -435,7 +414,6 @@ 292 {{55, 15}, {182, 29}} - NO @@ -466,7 +444,6 @@ {{0, 64}, {320, 367}} - 3 @@ -550,14 +527,6 @@ 52 - - - searchTextFieldBackground - - - - 53 - searchBackgroundView @@ -925,147 +894,7 @@ 57 - - - YES - - PPViewController - UIViewController - - IBProjectSource - ./Classes/PPViewController.h - - - - SearchProductController - PPViewController - - YES - - YES - clickSearchButton: - doSearch: - speechSearch: - - - YES - id - id - id - - - - YES - - YES - clickSearchButton: - doSearch: - speechSearch: - - - YES - - clickSearchButton: - id - - - doSearch: - id - - - speechSearch: - id - - - - - YES - - YES - keywordSearchBar - latestSearchButton1 - latestSearchButton2 - latestSearchButton3 - searchBackgroundView - searchButton - searchTextField - searchTextFieldBackground - searchTextFieldBackgroundView - - - YES - UISearchBar - UIButton - UIButton - UIButton - UIImageView - UIButton - UITextField - UIImageView - UIImageView - - - - YES - - YES - keywordSearchBar - latestSearchButton1 - latestSearchButton2 - latestSearchButton3 - searchBackgroundView - searchButton - searchTextField - searchTextFieldBackground - searchTextFieldBackgroundView - - - YES - - keywordSearchBar - UISearchBar - - - latestSearchButton1 - UIButton - - - latestSearchButton2 - UIButton - - - latestSearchButton3 - UIButton - - - searchBackgroundView - UIImageView - - - searchButton - UIButton - - - searchTextField - UITextField - - - searchTextFieldBackground - UIImageView - - - searchTextFieldBackgroundView - UIImageView - - - - - IBProjectSource - ./Classes/SearchProductController.h - - - - + 0 IBCocoaTouchFramework diff --git a/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.h b/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.h index 019c223..8e21bf0 100644 --- a/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.h +++ b/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.h @@ -12,5 +12,6 @@ @interface PPViewController (GroupBuyControllerExt) + (UIView*)groupbuyAccessoryView; ++ (UIView*)getFooterView; @end diff --git a/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.m b/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.m index d15962c..99c9304 100644 --- a/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.m +++ b/GroupBuyCommon/Controller/Utils/GroupBuyControllerExt.m @@ -22,4 +22,15 @@ + (UIView*)groupbuyAccessoryView return [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tu_105-51.png"]]; } ++ (UIView*)getFooterView +{ + UIImage *image = [UIImage imageNamed:@"tu_179.png"]; + UIImageView *footerImageView = [[UIImageView alloc] initWithImage:image]; + [footerImageView setFrame:CGRectMake(7, 0, 320-7*2, 2)]; + UIView *view = [[[UIView alloc] init] autorelease]; + [view addSubview:footerImageView]; + [footerImageView release]; + return view; +} + @end diff --git a/Location/MapViewUtil.m b/Location/MapViewUtil.m index e8cd9e1..bc60931 100644 --- a/Location/MapViewUtil.m +++ b/Location/MapViewUtil.m @@ -81,10 +81,7 @@ - (MKCoordinateSpan)coordinateSpanWithMapView:(MKMapView *)mapView - (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(NSUInteger)zoomLevel animated:(BOOL)animated -{ - centerCoordinate.longitude = 23.10163f; - centerCoordinate.latitude = 113.27282f; - +{ // clamp large numbers to 28 zoomLevel = MIN(zoomLevel, 28);