From 6f7144d63ccb1c8ce87c5ae9fa296335097f0491 Mon Sep 17 00:00:00 2001 From: Roy Yang Date: Sun, 24 Jun 2012 18:55:57 -0700 Subject: [PATCH] adding in favicon and vertical align for uilabel --- media/iphone/Classes/NewsBlurAppDelegate.m | 7 ++-- media/iphone/Classes/ShareViewController.h | 1 + media/iphone/Classes/ShareViewController.m | 26 +++++++++++--- media/iphone/Classes/ShareViewController.xib | 35 ++++++++++--------- .../Classes/StoryDetailViewController.m | 5 ++- 5 files changed, 44 insertions(+), 30 deletions(-) diff --git a/media/iphone/Classes/NewsBlurAppDelegate.m b/media/iphone/Classes/NewsBlurAppDelegate.m index 0fa57f5af..3ef0f44d0 100644 --- a/media/iphone/Classes/NewsBlurAppDelegate.m +++ b/media/iphone/Classes/NewsBlurAppDelegate.m @@ -313,6 +313,7 @@ - (void)showShareView { [splitStoryDetailViewController.view addSubview:shareViewController.view]; + [shareViewController setSiteInfo]; if (UIInterfaceOrientationIsPortrait(splitStoryDetailViewController.interfaceOrientation)) { shareViewController.view.frame = CGRectMake(0, @@ -353,9 +354,7 @@ } } -- (void)hideShareView { - [splitStoryDetailViewController.view addSubview:shareViewController.view]; - +- (void)hideShareView { if (UIInterfaceOrientationIsPortrait(splitStoryDetailViewController.interfaceOrientation)) { if ((960 - self.feedDetailPortraitYCoordinate) < SHARE_MODAL_HEIGHT) { storyDetailViewController.view.frame = CGRectMake(0, @@ -383,8 +382,6 @@ 768, 960 - self.feedDetailPortraitYCoordinate); }]; - - } } diff --git a/media/iphone/Classes/ShareViewController.h b/media/iphone/Classes/ShareViewController.h index 6df52c712..dc378e45b 100644 --- a/media/iphone/Classes/ShareViewController.h +++ b/media/iphone/Classes/ShareViewController.h @@ -19,6 +19,7 @@ @property (retain, nonatomic) IBOutlet UITextView *commentField; @property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate; +- (void)setSiteInfo; - (IBAction)doCancelButton:(id)sender; - (IBAction)doToggleButton:(id)sender; - (IBAction)doShareThisStory:(id)sender; diff --git a/media/iphone/Classes/ShareViewController.m b/media/iphone/Classes/ShareViewController.m index 45c57bbce..9187f6896 100644 --- a/media/iphone/Classes/ShareViewController.m +++ b/media/iphone/Classes/ShareViewController.m @@ -10,6 +10,7 @@ #import "NewsBlurAppDelegate.h" #import "StoryDetailViewController.h" #import +#import "Utilities.h" #import "ASIHTTPRequest.h" @implementation ShareViewController @@ -48,6 +49,25 @@ // e.g. self.myOutlet = nil; } +- (void)setSiteInfo { + [self.siteInformation setNumberOfLines:2]; + + NSString *siteInfoString = [NSString stringWithFormat:@"%@: %@", + [appDelegate.activeFeed objectForKey:@"feed_title"], + [appDelegate.activeStory objectForKey:@"story_title"]]; + + [self.siteInformation setText:siteInfoString]; + + // vertical align label + CGRect resizedLabel = [self.siteInformation textRectForBounds:self.siteInformation.bounds limitedToNumberOfLines:2]; + CGRect newResizedLabelFrame = self.siteInformation.frame; + newResizedLabelFrame.size.height = resizedLabel.size.height; + self.siteInformation.frame = newResizedLabelFrame; + + // adding in favicon + NSString *feedIdStr = [NSString stringWithFormat:@"%@", [appDelegate.activeStory objectForKey:@"story_feed_id"]]; + [siteFavicon setImage:[Utilities getImage:feedIdStr]]; +} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation @@ -59,11 +79,7 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; - NSString *siteInfoString = [NSString stringWithFormat:@"%@: %@", - [appDelegate.activeFeed objectForKey:@"feed_title"], - [appDelegate.activeStory objectForKey:@"story_title"]]; - - [self.siteInformation setText:siteInfoString]; + } - (void)dealloc { diff --git a/media/iphone/Classes/ShareViewController.xib b/media/iphone/Classes/ShareViewController.xib index 6fe1aee0f..7f7856194 100644 --- a/media/iphone/Classes/ShareViewController.xib +++ b/media/iphone/Classes/ShareViewController.xib @@ -82,7 +82,7 @@ 292 - {{155, 119}, {375, 144}} + {{155, 136}, {375, 144}} @@ -113,7 +113,7 @@ 292 - {{554, 119}, {60, 60}} + {{554, 136}, {60, 60}} @@ -158,10 +158,9 @@ 292 - {{554, 203}, {60, 60}} + {{554, 220}, {60, 60}} - _NS:9 NO IBIPadFramework @@ -192,7 +191,7 @@ {{155, 64}, {16, 16}} - + _NS:9 NO IBIPadFramework @@ -204,17 +203,17 @@ 292 - {{179, 61}, {351, 21}} + {{179, 60}, {435, 54}} - + _NS:9 NO YES 7 NO IBIPadFramework - Site Name: Story Title + Site Name: Story Titlesdaf asdfsda fsdaf sdaf sda fsdaf sdaf sda fsda f 1 MCAwIDAAA @@ -222,23 +221,25 @@ 0 10 + 2 1 - 17 + 16 Helvetica - 17 + 16 16 + NO 292 - {{155, 96}, {84, 21}} + {{155, 113}, {84, 21}} - + _NS:9 NO YES @@ -263,7 +264,7 @@ 292 - {{446, 96}, {84, 21}} + {{446, 113}, {84, 21}} @@ -405,13 +406,13 @@ + + + - - - @@ -501,7 +502,7 @@ - 34 + 35 diff --git a/media/iphone/Classes/StoryDetailViewController.m b/media/iphone/Classes/StoryDetailViewController.m index b797270de..707416479 100644 --- a/media/iphone/Classes/StoryDetailViewController.m +++ b/media/iphone/Classes/StoryDetailViewController.m @@ -170,9 +170,8 @@ - (NSString *)getComments { NSString *comments = @""; - int share_count = [[appDelegate.activeStory objectForKey:@"share_count"] intValue]; - - if (share_count) { + NSLog(@"the sharecount is %@", [appDelegate.activeStory objectForKey:@"share_count"]); + if ([appDelegate.activeStory objectForKey:@"share_count"] != [NSNull null]) { NSArray *comments_array = [appDelegate.activeStory objectForKey:@"comments"]; comments = [comments stringByAppendingString:[NSString stringWithFormat:@ "
"