adding in font size persistence

This commit is contained in:
Roy Yang 2012-06-24 23:02:37 -07:00
parent e91b254e45
commit 64c559c754
14 changed files with 510 additions and 349 deletions

View file

@ -18,10 +18,12 @@
} }
@property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate; @property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate;
@property (nonatomic, retain) IBOutlet UILabel *smallFontSizeLabel; @property (retain, nonatomic) IBOutlet UISegmentedControl *fontStyleSegment;
@property (nonatomic, retain) IBOutlet UILabel *largeFontSizeLabel; @property (retain, nonatomic) IBOutlet UISegmentedControl *fontSizeSgement;
- (IBAction)changeFontStyle:(id)sender; - (IBAction)changeFontStyle:(id)sender;
- (IBAction)changeFontSize:(id)sender; - (IBAction)changeFontSize:(id)sender;
- (void)setSanSerif;
- (void)setSerif;
@end @end

View file

@ -13,8 +13,8 @@
@implementation FontSettingsViewController @implementation FontSettingsViewController
@synthesize appDelegate; @synthesize appDelegate;
@synthesize smallFontSizeLabel; @synthesize fontStyleSegment;
@synthesize largeFontSizeLabel; @synthesize fontSizeSgement;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{ {
@ -29,13 +29,46 @@
{ {
self.contentSizeForViewInPopover = CGSizeMake(274.0,130.0); self.contentSizeForViewInPopover = CGSizeMake(274.0,130.0);
[super viewDidLoad]; [super viewDidLoad];
}
- (void)viewWillAppear:(BOOL)animated {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
if ([userPreferences stringForKey:@"fontStyle"]) {
if ([[userPreferences stringForKey:@"fontStyle"] isEqualToString:@"NB-san-serif"]) {
[self setSanSerif];
} else if ([[userPreferences stringForKey:@"fontStyle"] isEqualToString:@"NB-serif"]) {
[self setSerif];
}
}
int userPreferenceFontSize = [userPreferences integerForKey:@"fontSize"];
if(userPreferenceFontSize){
switch (userPreferenceFontSize) {
case 12:
[fontSizeSgement setSelectedSegmentIndex:0];
break;
case 14:
[fontSizeSgement setSelectedSegmentIndex:1];
break;
case 16:
[fontSizeSgement setSelectedSegmentIndex:2];
break;
case 22:
[fontSizeSgement setSelectedSegmentIndex:3];
break;
case 26:
[fontSizeSgement setSelectedSegmentIndex:4];
break;
default:
break;
}
}
// Do any additional setup after loading the view from its nib. // Do any additional setup after loading the view from its nib.
} }
- (void)viewDidUnload - (void)viewDidUnload
{ {
smallFontSizeLabel = nil; [self setFontStyleSegment:nil];
largeFontSizeLabel = nil; [self setFontSizeSgement:nil];
[super viewDidUnload]; [super viewDidUnload];
// Release any retained subviews of the main view. // Release any retained subviews of the main view.
// e.g. self.myOutlet = nil; // e.g. self.myOutlet = nil;
@ -48,31 +81,49 @@
- (void)dealloc { - (void)dealloc {
[appDelegate release]; [appDelegate release];
[smallFontSizeLabel release]; [fontStyleSegment release];
[largeFontSizeLabel release]; [fontSizeSgement release];
[super dealloc]; [super dealloc];
} }
- (IBAction)changeFontStyle:(id)sender { - (IBAction)changeFontStyle:(id)sender {
if ([sender selectedSegmentIndex] == 0) { if ([sender selectedSegmentIndex] == 0) {
UIFont *smallFont = [UIFont fontWithName:@"Helvetica" size:15.0]; [self setSanSerif];
[self.smallFontSizeLabel setFont:smallFont];
UIFont *largeFont = [UIFont fontWithName:@"Georgia" size:24.0];
[self.largeFontSizeLabel setFont:largeFont];
[appDelegate.storyDetailViewController setFontStyle:@"Helvetica"];
} else { } else {
UIFont *smallFont = [UIFont fontWithName:@"Georgia" size:15.0]; [self setSerif];
[self.smallFontSizeLabel setFont:smallFont]; }
UIFont *largeFont = [UIFont fontWithName:@"Georgia" size:24.0]; }
[self.largeFontSizeLabel setFont:largeFont];
- (IBAction)changeFontSize:(id)sender {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
if ([sender selectedSegmentIndex] == 0) {
[appDelegate.storyDetailViewController setFontSize:12];
[userPreferences setInteger:12 forKey:@"fontSize"];
} else if ([sender selectedSegmentIndex] == 1) {
[appDelegate.storyDetailViewController setFontSize:14];
[userPreferences setInteger:14 forKey:@"fontSize"];
} else if ([sender selectedSegmentIndex] == 2) {
[appDelegate.storyDetailViewController setFontSize:16];
[userPreferences setInteger:16 forKey:@"fontSize"];
} else if ([sender selectedSegmentIndex] == 3) {
[appDelegate.storyDetailViewController setFontSize:22];
[userPreferences setInteger:22 forKey:@"fontSize"];
} else if ([sender selectedSegmentIndex] == 4) {
[appDelegate.storyDetailViewController setFontSize:26];
[userPreferences setInteger:26 forKey:@"fontSize"];
}
[userPreferences synchronize];
}
- (void)setSanSerif {
[fontStyleSegment setSelectedSegmentIndex:0];
[appDelegate.storyDetailViewController setFontStyle:@"Helvetica"];
}
- (void)setSerif {
[fontStyleSegment setSelectedSegmentIndex:1];
[appDelegate.storyDetailViewController setFontStyle:@"Georgia"]; [appDelegate.storyDetailViewController setFontStyle:@"Georgia"];
} }
}
- (IBAction)changeFontSize:(UISlider *)sender {
[appDelegate.storyDetailViewController setFontSize:[sender value]];
}
@end @end

View file

@ -11,11 +11,9 @@
<string key="NS.object.0">1181</string> <string key="NS.object.0">1181</string>
</object> </object>
<array key="IBDocument.IntegratedClassDependencies"> <array key="IBDocument.IntegratedClassDependencies">
<string>IBUISlider</string>
<string>IBUISegmentedControl</string>
<string>IBUIView</string>
<string>IBUILabel</string>
<string>IBProxyObject</string> <string>IBProxyObject</string>
<string>IBUIView</string>
<string>IBUISegmentedControl</string>
</array> </array>
<array key="IBDocument.PluginDependencies"> <array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -37,87 +35,13 @@
<reference key="NSNextResponder"/> <reference key="NSNextResponder"/>
<int key="NSvFlags">292</int> <int key="NSvFlags">292</int>
<array class="NSMutableArray" key="NSSubviews"> <array class="NSMutableArray" key="NSSubviews">
<object class="IBUILabel" id="154305918">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 90}, {42, 21}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="259839465"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<string key="IBUIText">A</string>
<object class="NSColor" key="IBUITextColor" id="237543767">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUILabel" id="12707086">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{232, 89}, {42, 21}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<string key="IBUIText">A</string>
<reference key="IBUITextColor" ref="237543767"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">24</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">24</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUISlider" id="259839465">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{48, 90}, {178, 23}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="12707086"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<float key="IBUIValue">100</float>
<float key="IBUIMinValue">50</float>
<float key="IBUIMaxValue">150</float>
</object>
<object class="IBUISegmentedControl" id="301635770"> <object class="IBUISegmentedControl" id="301635770">
<reference key="NSNextResponder" ref="766721923"/> <reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int> <int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 20}, {234, 30}}</string> <string key="NSFrame">{{20, 20}, {234, 30}}</string>
<reference key="NSSuperview" ref="766721923"/> <reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="154305918"/> <reference key="NSNextKeyView" ref="583946447"/>
<string key="NSReuseIdentifierKey">_NS:9</string> <string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool> <bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string> <string key="targetRuntimeIdentifier">IBIPadFramework</string>
@ -145,6 +69,55 @@
<reference ref="4"/> <reference ref="4"/>
</array> </array>
</object> </object>
<object class="IBUISegmentedControl" id="583946447">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 81}, {234, 30}}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBSegmentControlStyle">2</int>
<int key="IBNumberOfSegments">5</int>
<int key="IBSelectedSegmentIndex">2</int>
<array key="IBSegmentTitles">
<string>12pt</string>
<string>14pt</string>
<string>16pt</string>
<string>22pt</string>
<string>26pt</string>
</array>
<array class="NSMutableArray" key="IBSegmentWidths">
<real value="0.0"/>
<real value="0.0"/>
<real value="0.0"/>
<real value="0.0"/>
<real value="0.0"/>
</array>
<array class="NSMutableArray" key="IBSegmentEnabledStates">
<boolean value="YES"/>
<boolean value="YES"/>
<boolean value="YES"/>
<boolean value="YES"/>
<boolean value="YES"/>
</array>
<array class="NSMutableArray" key="IBSegmentContentOffsets">
<string>{0, 0}</string>
<string>{0, 0}</string>
<string>{0, 0}</string>
<string>{0, 0}</string>
<string>{0, 0}</string>
</array>
<array class="NSMutableArray" key="IBSegmentImages">
<reference ref="4"/>
<reference ref="4"/>
<reference ref="4"/>
<reference ref="4"/>
<reference ref="4"/>
</array>
</object>
</array> </array>
<string key="NSFrameSize">{274, 130}</string> <string key="NSFrameSize">{274, 130}</string>
<reference key="NSSuperview"/> <reference key="NSSuperview"/>
@ -177,28 +150,19 @@
</object> </object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection"> <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">largeFontSizeLabel</string> <string key="label">fontStyleSegment</string>
<reference key="source" ref="841351856"/> <reference key="source" ref="841351856"/>
<reference key="destination" ref="12707086"/> <reference key="destination" ref="301635770"/>
</object> </object>
<int key="connectionID">19</int> <int key="connectionID">32</int>
</object> </object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection"> <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">smallFontSizeLabel</string> <string key="label">fontSizeSgement</string>
<reference key="source" ref="841351856"/> <reference key="source" ref="841351856"/>
<reference key="destination" ref="154305918"/> <reference key="destination" ref="583946447"/>
</object> </object>
<int key="connectionID">17</int> <int key="connectionID">33</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">changeFontSize:</string>
<reference key="source" ref="259839465"/>
<reference key="destination" ref="841351856"/>
<int key="IBEventType">13</int>
</object>
<int key="connectionID">13</int>
</object> </object>
<object class="IBConnectionRecord"> <object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection"> <object class="IBCocoaTouchEventConnection" key="connection">
@ -209,6 +173,15 @@
</object> </object>
<int key="connectionID">12</int> <int key="connectionID">12</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">changeFontSize:</string>
<reference key="source" ref="583946447"/>
<reference key="destination" ref="841351856"/>
<int key="IBEventType">13</int>
</object>
<int key="connectionID">29</int>
</object>
</array> </array>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects"> <array key="orderedObjects">
@ -234,9 +207,7 @@
<reference key="object" ref="766721923"/> <reference key="object" ref="766721923"/>
<array class="NSMutableArray" key="children"> <array class="NSMutableArray" key="children">
<reference ref="301635770"/> <reference ref="301635770"/>
<reference ref="154305918"/> <reference ref="583946447"/>
<reference ref="12707086"/>
<reference ref="259839465"/>
</array> </array>
<reference key="parent" ref="0"/> <reference key="parent" ref="0"/>
</object> </object>
@ -246,18 +217,8 @@
<reference key="parent" ref="766721923"/> <reference key="parent" ref="766721923"/>
</object> </object>
<object class="IBObjectRecord"> <object class="IBObjectRecord">
<int key="objectID">8</int> <int key="objectID">28</int>
<reference key="object" ref="12707086"/> <reference key="object" ref="583946447"/>
<reference key="parent" ref="766721923"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="154305918"/>
<reference key="parent" ref="766721923"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="259839465"/>
<reference key="parent" ref="766721923"/> <reference key="parent" ref="766721923"/>
</object> </object>
</array> </array>
@ -269,15 +230,14 @@
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <string key="28.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> <integer value="2" key="28.IUISegmentedControlInspectorSelectedSegmentMetadataKey"/>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary> </dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/> <nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/> <dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">22</int> <int key="maxID">33</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions"> <array class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -410,6 +370,28 @@
<string key="minorKey">./Classes/BaseViewController.h</string> <string key="minorKey">./Classes/BaseViewController.h</string>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription">
<string key="className">FeedDashboardViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="appDelegate">NewsBlurAppDelegate</string>
<string key="toolbar">UIToolbar</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="appDelegate">
<string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string>
</object>
<object class="IBToOneOutletInfo" key="toolbar">
<string key="name">toolbar</string>
<string key="candidateClassName">UIToolbar</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/FeedDashboardViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">FeedDetailViewController</string> <string key="className">FeedDetailViewController</string>
<string key="superclassName">BaseViewController</string> <string key="superclassName">BaseViewController</string>
@ -477,89 +459,41 @@
</object> </object>
</object> </object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">FeedsViewController</string> <string key="className">FeedsMenuViewController</string>
<string key="superclassName">BaseViewController</string> <string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="actions"> <object class="NSMutableDictionary" key="actions">
<string key="doAddButton">id</string> <string key="NS.key.0">tapCancelButton:</string>
<string key="doLogoutButton">id</string> <string key="NS.object.0">UIBarButtonItem</string>
<string key="doSwitchSitesUnread">id</string>
<string key="sectionTapped:">UIButton</string>
<string key="sectionUntapped:">UIButton</string>
<string key="selectIntelligence">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="doAddButton">
<string key="name">doAddButton</string>
<string key="candidateClassName">id</string>
</object> </object>
<object class="IBActionInfo" key="doLogoutButton"> <object class="NSMutableDictionary" key="actionInfosByName">
<string key="name">doLogoutButton</string> <string key="NS.key.0">tapCancelButton:</string>
<string key="candidateClassName">id</string> <object class="IBActionInfo" key="NS.object.0">
</object> <string key="name">tapCancelButton:</string>
<object class="IBActionInfo" key="doSwitchSitesUnread">
<string key="name">doSwitchSitesUnread</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="sectionTapped:">
<string key="name">sectionTapped:</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBActionInfo" key="sectionUntapped:">
<string key="name">sectionUntapped:</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBActionInfo" key="selectIntelligence">
<string key="name">selectIntelligence</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="addButton">UIBarButtonItem</string>
<string key="appDelegate">NewsBlurAppDelegate</string>
<string key="feedScoreSlider">UISlider</string>
<string key="feedTitlesTable">UITableView</string>
<string key="feedViewToolbar">UIToolbar</string>
<string key="intelligenceControl">UISegmentedControl</string>
<string key="logoutButton">UIBarButtonItem</string>
<string key="sitesButton">UIBarButtonItem</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="addButton">
<string key="name">addButton</string>
<string key="candidateClassName">UIBarButtonItem</string> <string key="candidateClassName">UIBarButtonItem</string>
</object> </object>
</object>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="appDelegate">NewsBlurAppDelegate</string>
<string key="menuTableView">UITableView</string>
<string key="toolbar">UIToolbar</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="appDelegate"> <object class="IBToOneOutletInfo" key="appDelegate">
<string key="name">appDelegate</string> <string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string> <string key="candidateClassName">NewsBlurAppDelegate</string>
</object> </object>
<object class="IBToOneOutletInfo" key="feedScoreSlider"> <object class="IBToOneOutletInfo" key="menuTableView">
<string key="name">feedScoreSlider</string> <string key="name">menuTableView</string>
<string key="candidateClassName">UISlider</string>
</object>
<object class="IBToOneOutletInfo" key="feedTitlesTable">
<string key="name">feedTitlesTable</string>
<string key="candidateClassName">UITableView</string> <string key="candidateClassName">UITableView</string>
</object> </object>
<object class="IBToOneOutletInfo" key="feedViewToolbar"> <object class="IBToOneOutletInfo" key="toolbar">
<string key="name">feedViewToolbar</string> <string key="name">toolbar</string>
<string key="candidateClassName">UIToolbar</string> <string key="candidateClassName">UIToolbar</string>
</object> </object>
<object class="IBToOneOutletInfo" key="intelligenceControl">
<string key="name">intelligenceControl</string>
<string key="candidateClassName">UISegmentedControl</string>
</object>
<object class="IBToOneOutletInfo" key="logoutButton">
<string key="name">logoutButton</string>
<string key="candidateClassName">UIBarButtonItem</string>
</object>
<object class="IBToOneOutletInfo" key="sitesButton">
<string key="name">sitesButton</string>
<string key="candidateClassName">UIBarButtonItem</string>
</object>
</dictionary> </dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier"> <object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string> <string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/FeedsViewController.h</string> <string key="minorKey">./Classes/FeedsMenuViewController.h</string>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
@ -595,6 +529,7 @@
<string key="addSitesView">UIView</string> <string key="addSitesView">UIView</string>
<string key="appDelegate">NewsBlurAppDelegate</string> <string key="appDelegate">NewsBlurAppDelegate</string>
<string key="googleReaderButton">UIButton</string> <string key="googleReaderButton">UIButton</string>
<string key="logo">UIImageView</string>
<string key="nextButton">UIBarButtonItem</string> <string key="nextButton">UIBarButtonItem</string>
<string key="toolbar">UIToolbar</string> <string key="toolbar">UIToolbar</string>
<string key="toolbarTitle">UIButton</string> <string key="toolbarTitle">UIButton</string>
@ -621,6 +556,10 @@
<string key="name">googleReaderButton</string> <string key="name">googleReaderButton</string>
<string key="candidateClassName">UIButton</string> <string key="candidateClassName">UIButton</string>
</object> </object>
<object class="IBToOneOutletInfo" key="logo">
<string key="name">logo</string>
<string key="candidateClassName">UIImageView</string>
</object>
<object class="IBToOneOutletInfo" key="nextButton"> <object class="IBToOneOutletInfo" key="nextButton">
<string key="name">nextButton</string> <string key="name">nextButton</string>
<string key="candidateClassName">UIBarButtonItem</string> <string key="candidateClassName">UIBarButtonItem</string>
@ -662,6 +601,8 @@
</dictionary> </dictionary>
<dictionary class="NSMutableDictionary" key="outlets"> <dictionary class="NSMutableDictionary" key="outlets">
<string key="appDelegate">NewsBlurAppDelegate</string> <string key="appDelegate">NewsBlurAppDelegate</string>
<string key="fontSizeSgement">UISegmentedControl</string>
<string key="fontStyleSegment">UISegmentedControl</string>
<string key="largeFontSizeLabel">UILabel</string> <string key="largeFontSizeLabel">UILabel</string>
<string key="smallFontSizeLabel">UILabel</string> <string key="smallFontSizeLabel">UILabel</string>
</dictionary> </dictionary>
@ -670,6 +611,14 @@
<string key="name">appDelegate</string> <string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string> <string key="candidateClassName">NewsBlurAppDelegate</string>
</object> </object>
<object class="IBToOneOutletInfo" key="fontSizeSgement">
<string key="name">fontSizeSgement</string>
<string key="candidateClassName">UISegmentedControl</string>
</object>
<object class="IBToOneOutletInfo" key="fontStyleSegment">
<string key="name">fontStyleSegment</string>
<string key="candidateClassName">UISegmentedControl</string>
</object>
<object class="IBToOneOutletInfo" key="largeFontSizeLabel"> <object class="IBToOneOutletInfo" key="largeFontSizeLabel">
<string key="name">largeFontSizeLabel</string> <string key="name">largeFontSizeLabel</string>
<string key="candidateClassName">UILabel</string> <string key="candidateClassName">UILabel</string>
@ -939,8 +888,10 @@
<string key="superclassName">BaseViewController</string> <string key="superclassName">BaseViewController</string>
<dictionary class="NSMutableDictionary" key="outlets"> <dictionary class="NSMutableDictionary" key="outlets">
<string key="addSiteViewController">AddSiteViewController</string> <string key="addSiteViewController">AddSiteViewController</string>
<string key="feedDashboardViewController">FeedDashboardViewController</string>
<string key="feedDetailViewController">FeedDetailViewController</string> <string key="feedDetailViewController">FeedDetailViewController</string>
<string key="feedsViewController">FeedsViewController</string> <string key="feedsMenuViewController">FeedsMenuViewController</string>
<string key="feedsViewController">NewsBlurViewController</string>
<string key="firstTimeUserViewController">FirstTimeUserViewController</string> <string key="firstTimeUserViewController">FirstTimeUserViewController</string>
<string key="fontSettingsViewController">FontSettingsViewController</string> <string key="fontSettingsViewController">FontSettingsViewController</string>
<string key="googleReaderViewController">GoogleReaderViewController</string> <string key="googleReaderViewController">GoogleReaderViewController</string>
@ -948,6 +899,7 @@
<string key="moveSiteViewController">MoveSiteViewController</string> <string key="moveSiteViewController">MoveSiteViewController</string>
<string key="navigationController">UINavigationController</string> <string key="navigationController">UINavigationController</string>
<string key="originalStoryViewController">OriginalStoryViewController</string> <string key="originalStoryViewController">OriginalStoryViewController</string>
<string key="shareViewController">ShareViewController</string>
<string key="splitStoryController">UISplitViewController</string> <string key="splitStoryController">UISplitViewController</string>
<string key="splitStoryDetailNavigationController">UINavigationController</string> <string key="splitStoryDetailNavigationController">UINavigationController</string>
<string key="splitStoryDetailViewController">SplitStoryDetailViewController</string> <string key="splitStoryDetailViewController">SplitStoryDetailViewController</string>
@ -959,13 +911,21 @@
<string key="name">addSiteViewController</string> <string key="name">addSiteViewController</string>
<string key="candidateClassName">AddSiteViewController</string> <string key="candidateClassName">AddSiteViewController</string>
</object> </object>
<object class="IBToOneOutletInfo" key="feedDashboardViewController">
<string key="name">feedDashboardViewController</string>
<string key="candidateClassName">FeedDashboardViewController</string>
</object>
<object class="IBToOneOutletInfo" key="feedDetailViewController"> <object class="IBToOneOutletInfo" key="feedDetailViewController">
<string key="name">feedDetailViewController</string> <string key="name">feedDetailViewController</string>
<string key="candidateClassName">FeedDetailViewController</string> <string key="candidateClassName">FeedDetailViewController</string>
</object> </object>
<object class="IBToOneOutletInfo" key="feedsMenuViewController">
<string key="name">feedsMenuViewController</string>
<string key="candidateClassName">FeedsMenuViewController</string>
</object>
<object class="IBToOneOutletInfo" key="feedsViewController"> <object class="IBToOneOutletInfo" key="feedsViewController">
<string key="name">feedsViewController</string> <string key="name">feedsViewController</string>
<string key="candidateClassName">FeedsViewController</string> <string key="candidateClassName">NewsBlurViewController</string>
</object> </object>
<object class="IBToOneOutletInfo" key="firstTimeUserViewController"> <object class="IBToOneOutletInfo" key="firstTimeUserViewController">
<string key="name">firstTimeUserViewController</string> <string key="name">firstTimeUserViewController</string>
@ -995,6 +955,10 @@
<string key="name">originalStoryViewController</string> <string key="name">originalStoryViewController</string>
<string key="candidateClassName">OriginalStoryViewController</string> <string key="candidateClassName">OriginalStoryViewController</string>
</object> </object>
<object class="IBToOneOutletInfo" key="shareViewController">
<string key="name">shareViewController</string>
<string key="candidateClassName">ShareViewController</string>
</object>
<object class="IBToOneOutletInfo" key="splitStoryController"> <object class="IBToOneOutletInfo" key="splitStoryController">
<string key="name">splitStoryController</string> <string key="name">splitStoryController</string>
<string key="candidateClassName">UISplitViewController</string> <string key="candidateClassName">UISplitViewController</string>
@ -1021,6 +985,87 @@
<string key="minorKey">./Classes/NewsBlurAppDelegate.h</string> <string key="minorKey">./Classes/NewsBlurAppDelegate.h</string>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription">
<string key="className">NewsBlurViewController</string>
<string key="superclassName">BaseViewController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="doSwitchSitesUnread">id</string>
<string key="sectionTapped:">UIButton</string>
<string key="sectionUntapped:">UIButton</string>
<string key="selectIntelligence">id</string>
<string key="showMenuButton">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="doSwitchSitesUnread">
<string key="name">doSwitchSitesUnread</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="sectionTapped:">
<string key="name">sectionTapped:</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBActionInfo" key="sectionUntapped:">
<string key="name">sectionUntapped:</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBActionInfo" key="selectIntelligence">
<string key="name">selectIntelligence</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="showMenuButton">
<string key="name">showMenuButton</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="appDelegate">NewsBlurAppDelegate</string>
<string key="feedScoreSlider">UISlider</string>
<string key="feedTitlesTable">UITableView</string>
<string key="feedViewToolbar">UIToolbar</string>
<string key="homeButton">UIBarButtonItem</string>
<string key="intelligenceControl">UISegmentedControl</string>
<string key="popoverController">UIPopoverController</string>
<string key="sitesButton">UIBarButtonItem</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="appDelegate">
<string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string>
</object>
<object class="IBToOneOutletInfo" key="feedScoreSlider">
<string key="name">feedScoreSlider</string>
<string key="candidateClassName">UISlider</string>
</object>
<object class="IBToOneOutletInfo" key="feedTitlesTable">
<string key="name">feedTitlesTable</string>
<string key="candidateClassName">UITableView</string>
</object>
<object class="IBToOneOutletInfo" key="feedViewToolbar">
<string key="name">feedViewToolbar</string>
<string key="candidateClassName">UIToolbar</string>
</object>
<object class="IBToOneOutletInfo" key="homeButton">
<string key="name">homeButton</string>
<string key="candidateClassName">UIBarButtonItem</string>
</object>
<object class="IBToOneOutletInfo" key="intelligenceControl">
<string key="name">intelligenceControl</string>
<string key="candidateClassName">UISegmentedControl</string>
</object>
<object class="IBToOneOutletInfo" key="popoverController">
<string key="name">popoverController</string>
<string key="candidateClassName">UIPopoverController</string>
</object>
<object class="IBToOneOutletInfo" key="sitesButton">
<string key="name">sitesButton</string>
<string key="candidateClassName">UIBarButtonItem</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NewsBlurViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">OriginalStoryViewController</string> <string key="className">OriginalStoryViewController</string>
<string key="superclassName">BaseViewController</string> <string key="superclassName">BaseViewController</string>
@ -1102,6 +1147,72 @@
<string key="minorKey">./Classes/OriginalStoryViewController.h</string> <string key="minorKey">./Classes/OriginalStoryViewController.h</string>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription">
<string key="className">ShareViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="doCancelButton:">id</string>
<string key="doShareThisStory:">id</string>
<string key="doToggleButton:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="doCancelButton:">
<string key="name">doCancelButton:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="doShareThisStory:">
<string key="name">doShareThisStory:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="doToggleButton:">
<string key="name">doToggleButton:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="appDelegate">NewsBlurAppDelegate</string>
<string key="commentField">UITextView</string>
<string key="facebookButton">UIButton</string>
<string key="fontSizeSegment">UISegmentedControl</string>
<string key="siteFavicon">UIImageView</string>
<string key="siteInformation">UILabel</string>
<string key="twitterButton">UIButton</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="appDelegate">
<string key="name">appDelegate</string>
<string key="candidateClassName">NewsBlurAppDelegate</string>
</object>
<object class="IBToOneOutletInfo" key="commentField">
<string key="name">commentField</string>
<string key="candidateClassName">UITextView</string>
</object>
<object class="IBToOneOutletInfo" key="facebookButton">
<string key="name">facebookButton</string>
<string key="candidateClassName">UIButton</string>
</object>
<object class="IBToOneOutletInfo" key="fontSizeSegment">
<string key="name">fontSizeSegment</string>
<string key="candidateClassName">UISegmentedControl</string>
</object>
<object class="IBToOneOutletInfo" key="siteFavicon">
<string key="name">siteFavicon</string>
<string key="candidateClassName">UIImageView</string>
</object>
<object class="IBToOneOutletInfo" key="siteInformation">
<string key="name">siteInformation</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="twitterButton">
<string key="name">twitterButton</string>
<string key="candidateClassName">UIButton</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ShareViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">SplitStoryDetailViewController</string> <string key="className">SplitStoryDetailViewController</string>
<string key="superclassName">UIViewController</string> <string key="superclassName">UIViewController</string>
@ -1127,6 +1238,7 @@
<dictionary class="NSMutableDictionary" key="actions"> <dictionary class="NSMutableDictionary" key="actions">
<string key="doNextUnreadStory">id</string> <string key="doNextUnreadStory">id</string>
<string key="doPreviousStory">id</string> <string key="doPreviousStory">id</string>
<string key="doShareButton:">id</string>
<string key="toggleFontSize:">id</string> <string key="toggleFontSize:">id</string>
</dictionary> </dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName"> <dictionary class="NSMutableDictionary" key="actionInfosByName">
@ -1138,6 +1250,10 @@
<string key="name">doPreviousStory</string> <string key="name">doPreviousStory</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
</object> </object>
<object class="IBActionInfo" key="doShareButton:">
<string key="name">doShareButton:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="toggleFontSize:"> <object class="IBActionInfo" key="toggleFontSize:">
<string key="name">toggleFontSize:</string> <string key="name">toggleFontSize:</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>

View file

@ -134,10 +134,9 @@
- (void)showLogin; - (void)showLogin;
- (void)showFeedsMenu; - (void)showFeedsMenu;
- (void)hideFeedsMenu; - (void)hideFeedsMenu;
- (void)pushFeedDetailToMasterPopover;
- (void)showAdd; - (void)showAdd;
- (void)showMasterPopover; - (void)showMasterPopover;
- (void)showPopover;
- (void)showMoveSite; - (void)showMoveSite;
- (void)loadFeedDetailView; - (void)loadFeedDetailView;
- (void)loadRiverFeedDetailView; - (void)loadRiverFeedDetailView;

View file

@ -438,7 +438,7 @@
// the storyDetailView is full screen // the storyDetailView is full screen
if (self.feedDetailPortraitYCoordinate == 960) { if (self.feedDetailPortraitYCoordinate == 960) {
storyDetailViewController.view.frame = CGRectMake(0,0,storyDetailViewController.view.frame.size.width, 960); storyDetailViewController.view.frame = CGRectMake(0, 0, 768, 960);
feedDashboardViewController.view.frame = CGRectMake(0, feedDashboardViewController.view.frame = CGRectMake(0,
0, 0,
storyDetailViewController.view.frame.size.width, storyDetailViewController.view.frame.size.width,

View file

@ -18,14 +18,12 @@
@property (retain, nonatomic) IBOutlet UILabel *siteInformation; @property (retain, nonatomic) IBOutlet UILabel *siteInformation;
@property (retain, nonatomic) IBOutlet UITextView *commentField; @property (retain, nonatomic) IBOutlet UITextView *commentField;
@property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate; @property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate;
@property (retain, nonatomic) IBOutlet UIButton *facebookButton;
@property (retain, nonatomic) IBOutlet UIButton *twitterButton;
- (void)setSiteInfo; - (void)setSiteInfo;
- (IBAction)doCancelButton:(id)sender; - (IBAction)doCancelButton:(id)sender;
- (IBAction)doToggleButton:(id)sender; - (IBAction)doToggleButton:(id)sender;
- (IBAction)doShareThisStory:(id)sender; - (IBAction)doShareThisStory:(id)sender;
@property (retain, nonatomic) IBOutlet UIButton *facebookButton;
@property (retain, nonatomic) IBOutlet UIButton *twitterButton;
@end @end

View file

@ -35,20 +35,14 @@
{ {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view from its nib. // Do any additional setup after loading the view from its nib.
commentField.layer.borderWidth = 1.0f; commentField.layer.borderWidth = 1.0f;
commentField.layer.cornerRadius = 8; commentField.layer.cornerRadius = 8;
commentField.layer.borderColor = [[UIColor grayColor] CGColor]; commentField.layer.borderColor = [[UIColor grayColor] CGColor];
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults]; NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
NSLog(@"facebook %d", [userPreferences integerForKey:@"shareToFacebook"]);
NSLog(@"twitter %d", [userPreferences integerForKey:@"shareToTwitter"]);
if ([userPreferences integerForKey:@"shareToFacebook"]){ if ([userPreferences integerForKey:@"shareToFacebook"]){
facebookButton.selected = YES; facebookButton.selected = YES;
} }
if ([userPreferences integerForKey:@"shareToTwitter"]){ if ([userPreferences integerForKey:@"shareToTwitter"]){
twitterButton.selected = YES; twitterButton.selected = YES;
} }
@ -133,18 +127,10 @@
[userPreferences setInteger:1 forKey:@"shareToTwitter"]; [userPreferences setInteger:1 forKey:@"shareToTwitter"];
} }
} }
[userPreferences synchronize]; [userPreferences synchronize];
NSLog(@"facebook %d", [userPreferences integerForKey:@"shareToFacebook"]);
NSLog(@"twitter %d", [userPreferences integerForKey:@"shareToTwitter"]);
} }
- (IBAction)doShareThisStory:(id)sender { - (IBAction)doShareThisStory:(id)sender {
for (id key in appDelegate.activeStory) {
NSLog(@"Key in appDelegate.activeStory is %@" , key);
}
NSString *urlString = [NSString stringWithFormat:@"http://%@/social/share_story", NSString *urlString = [NSString stringWithFormat:@"http://%@/social/share_story",
NEWSBLUR_URL]; NEWSBLUR_URL];
@ -189,7 +175,7 @@
CGRect shareViewFrame = self.view.frame; CGRect shareViewFrame = self.view.frame;
CGRect storyDetailViewFrame = appDelegate.storyDetailViewController.view.frame; CGRect storyDetailViewFrame = appDelegate.storyDetailViewController.view.frame;
NSLog(@"Keyboard y is %f", keyboardFrame.size.height); //NSLog(@"Keyboard y is %f", keyboardFrame.size.height);
shareViewFrame.origin.y = shareViewFrame.origin.y + keyboardFrame.size.height; shareViewFrame.origin.y = shareViewFrame.origin.y + keyboardFrame.size.height;
storyDetailViewFrame.size.height = storyDetailViewFrame.size.height + keyboardFrame.size.height; storyDetailViewFrame.size.height = storyDetailViewFrame.size.height + keyboardFrame.size.height;
@ -213,7 +199,7 @@
CGRect shareViewFrame = self.view.frame; CGRect shareViewFrame = self.view.frame;
CGRect storyDetailViewFrame = appDelegate.storyDetailViewController.view.frame; CGRect storyDetailViewFrame = appDelegate.storyDetailViewController.view.frame;
NSLog(@"Keyboard y is %f", keyboardFrame.size.height); //NSLog(@"Keyboard y is %f", keyboardFrame.size.height);
shareViewFrame.origin.y = shareViewFrame.origin.y - keyboardFrame.size.height; shareViewFrame.origin.y = shareViewFrame.origin.y - keyboardFrame.size.height;
storyDetailViewFrame.size.height = storyDetailViewFrame.size.height - keyboardFrame.size.height; storyDetailViewFrame.size.height = storyDetailViewFrame.size.height - keyboardFrame.size.height;

View file

@ -37,7 +37,6 @@
@property (nonatomic, retain) IBOutlet UIView *feedTitleGradient; @property (nonatomic, retain) IBOutlet UIView *feedTitleGradient;
@property (retain,nonatomic) UIPopoverController *popoverController; @property (retain,nonatomic) UIPopoverController *popoverController;
- (void)showPopover;
- (void)setNextPreviousButtons; - (void)setNextPreviousButtons;
- (void)markStoryAsRead; - (void)markStoryAsRead;
- (void)showStory; - (void)showStory;

View file

@ -99,13 +99,21 @@
action:@selector(showOriginalSubview:) action:@selector(showOriginalSubview:)
]; ];
UIBarButtonItem *fontSettingsButton = [[UIBarButtonItem alloc]
initWithTitle:@"Aa"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(toggleFontSize:)
];
if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad) { if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad) {
appDelegate.splitStoryDetailViewController.navigationItem.rightBarButtonItem = originalButton; appDelegate.splitStoryDetailViewController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:originalButton, fontSettingsButton, nil];
} else { } else {
self.navigationItem.rightBarButtonItem = originalButton; self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:originalButton, fontSettingsButton, nil];
} }
[originalButton release]; [originalButton release];
[fontSettingsButton release];
[super viewDidAppear:animated]; [super viewDidAppear:animated];
} }
@ -117,6 +125,7 @@
self.activeStoryId = nil; self.activeStoryId = nil;
[webView loadHTMLString:@"" baseURL:[NSURL URLWithString:@""]]; [webView loadHTMLString:@"" baseURL:[NSURL URLWithString:@""]];
} }
[popoverController dismissPopoverAnimated:YES];
} }
#pragma mark - #pragma mark -
@ -162,7 +171,7 @@
} }
if (areFriends && [share_user_ids count]) { if (areFriends && [share_user_ids count]) {
avatarString = [avatarString stringByAppendingString:@"</div"]; avatarString = [avatarString stringByAppendingString:@"</div>"];
} }
return avatarString; return avatarString;
@ -170,7 +179,6 @@
- (NSString *)getComments { - (NSString *)getComments {
NSString *comments = @""; NSString *comments = @"";
NSLog(@"the sharecount is %@", [appDelegate.activeStory objectForKey:@"share_count"]);
if ([appDelegate.activeStory objectForKey:@"share_count"] != [NSNull null]) { if ([appDelegate.activeStory objectForKey:@"share_count"] != [NSNull null]) {
NSArray *comments_array = [appDelegate.activeStory objectForKey:@"comments"]; NSArray *comments_array = [appDelegate.activeStory objectForKey:@"comments"];
comments = [comments stringByAppendingString:[NSString stringWithFormat:@ comments = [comments stringByAppendingString:[NSString stringWithFormat:@
@ -184,7 +192,6 @@
"%@" "%@"
"</div>" "</div>"
"%@" "%@"
"</div></div>", "</div></div>",
@ -196,6 +203,7 @@
]]; ]];
for (int i = 0; i < comments_array.count; i++) { for (int i = 0; i < comments_array.count; i++) {
NSDictionary *comment_dict = [comments_array objectAtIndex:i]; NSDictionary *comment_dict = [comments_array objectAtIndex:i];
NSDictionary *user = [self getUser:[[comment_dict objectForKey:@"user_id"] intValue]]; NSDictionary *user = [self getUser:[[comment_dict objectForKey:@"user_id"] intValue]];
NSString *comment = [NSString stringWithFormat:@ NSString *comment = [NSString stringWithFormat:@
@ -222,7 +230,6 @@
comments = [comments stringByAppendingString:comment]; comments = [comments stringByAppendingString:comment];
} }
comments = [comments stringByAppendingString:[NSString stringWithFormat:@"</div>"]]; comments = [comments stringByAppendingString:[NSString stringWithFormat:@"</div>"]];
} }
return comments; return comments;
} }
@ -262,15 +269,17 @@
} }
- (void)showStory { - (void)showStory {
NSString *commentsString = [self getComments];
NSString *customImgCssString, *universalImgCssString, *sharingHtmlString;
NSString *customBodyClass = @"";
for (id key in appDelegate.activeStory) { NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
if ([userPreferences stringForKey:@"fontStyle"]){
NSLog(@"key is: %@ value: %@", key, [appDelegate.activeStory objectForKey:key]); customBodyClass = [customBodyClass stringByAppendingString:[userPreferences stringForKey:@"fontStyle"]];
} else {
customBodyClass = [customBodyClass stringByAppendingString:@"NB-san-serif"];
} }
NSString *commentsString = [self getComments];
NSString *customImgCssString, *universalImgCssString, *sharingHtmlString;
// set up layout values based on iPad/iPhone // set up layout values based on iPad/iPhone
universalImgCssString = [NSString stringWithFormat:@ universalImgCssString = [NSString stringWithFormat:@
"<script src=\"zepto.js\"></script>" "<script src=\"zepto.js\"></script>"
@ -333,20 +342,21 @@
story_tags]; story_tags];
NSString *htmlString = [NSString stringWithFormat:@ NSString *htmlString = [NSString stringWithFormat:@
"<html><head>%@ %@</head>" "<html><head>%@ %@</head>"
"<body id=\"story_pane\">%@" "<body id=\"story_pane\" class=\"%@\">%@"
"<div class=\"NB-story\">%@ </div>" "<div class=\"NB-story\">%@ </div>"
"%@" // comments "%@" // comments
"%@" // share "%@" // share
"</body></html>", "</body></html>",
universalImgCssString, universalImgCssString,
customImgCssString, customImgCssString,
customBodyClass,
storyHeader, storyHeader,
[appDelegate.activeStory objectForKey:@"story_content"], [appDelegate.activeStory objectForKey:@"story_content"],
commentsString, commentsString,
sharingHtmlString sharingHtmlString
]; ];
// NSLog(@"\n\n\n\nstory content\n\n\n%@<div class=\"NB-story\">%@</div>\n\n\n", storyHeader, [appDelegate.activeStory objectForKey:@"story_content"]); NSLog(@"\n\n\n\nhtmlString:\n\n\n%@\n\n\n", htmlString);
NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path]; NSURL *baseURL = [NSURL fileURLWithPath:path];
@ -414,9 +424,18 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
} }
- (void)webViewDidStartLoad:(UIWebView *)webView { - (void)webViewDidStartLoad:(UIWebView *)webView {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
if ([userPreferences integerForKey:@"fontSize"]){
[self setFontSize:[userPreferences integerForKey:@"fontSize"]];
}
} }
- (void)webViewDidFinishLoad:(UIWebView *)webView { - (void)webViewDidFinishLoad:(UIWebView *)webView {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
if ([userPreferences integerForKey:@"fontSize"]){
[self setFontSize:[userPreferences integerForKey:@"fontSize"]];
}
} }
#pragma mark - #pragma mark -
@ -571,13 +590,21 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
} }
- (void)setFontSize:(float)fontSize { - (void)setFontSize:(float)fontSize {
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%f%%'", NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.fontSize= '%fpx'",
fontSize]; fontSize];
[self.webView stringByEvaluatingJavaScriptFromString:jsString]; [self.webView stringByEvaluatingJavaScriptFromString:jsString];
[jsString release]; [jsString release];
} }
- (void)setFontStyle:(NSString *)fontStyle { - (void)setFontStyle:(NSString *)fontStyle {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
if ([fontStyle isEqualToString:@"Helvetica"]) {
[userPreferences setObject:@"NB-san-serif" forKey:@"fontStyle"];
} else {
[userPreferences setObject:@"NB-serif" forKey:@"fontStyle"];
}
[userPreferences synchronize];
NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.fontFamily= '%@'", NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.fontFamily= '%@'",
fontStyle]; fontStyle];
[self.webView stringByEvaluatingJavaScriptFromString:jsString]; [self.webView stringByEvaluatingJavaScriptFromString:jsString];

View file

@ -612,6 +612,8 @@
437AA8AB15922D13005463F5 /* FeedDashboardViewController.m */, 437AA8AB15922D13005463F5 /* FeedDashboardViewController.m */,
439DAB1D1590DA350019B0EB /* FeedsMenuViewController.h */, 439DAB1D1590DA350019B0EB /* FeedsMenuViewController.h */,
439DAB1E1590DA350019B0EB /* FeedsMenuViewController.m */, 439DAB1E1590DA350019B0EB /* FeedsMenuViewController.m */,
43763ACE158F90B100B3DBE2 /* FontSettingsViewController.h */,
43763ACF158F90B100B3DBE2 /* FontSettingsViewController.m */,
28D7ACF60DDB3853001CB0EB /* NewsBlurViewController.h */, 28D7ACF60DDB3853001CB0EB /* NewsBlurViewController.h */,
28D7ACF70DDB3853001CB0EB /* NewsBlurViewController.m */, 28D7ACF70DDB3853001CB0EB /* NewsBlurViewController.m */,
FFCE7AE513D49165009A98F6 /* FeedTableCell.h */, FFCE7AE513D49165009A98F6 /* FeedTableCell.h */,
@ -634,8 +636,6 @@
7842ECF611D44A530066CF9D /* StoryDetailViewController.m */, 7842ECF611D44A530066CF9D /* StoryDetailViewController.m */,
FFE5322D144C8AC300ACFDE0 /* Utilities.h */, FFE5322D144C8AC300ACFDE0 /* Utilities.h */,
FFE5322E144C8AC300ACFDE0 /* Utilities.m */, FFE5322E144C8AC300ACFDE0 /* Utilities.m */,
43763ACE158F90B100B3DBE2 /* FontSettingsViewController.h */,
43763ACF158F90B100B3DBE2 /* FontSettingsViewController.m */,
); );
path = Classes; path = Classes;
sourceTree = "<group>"; sourceTree = "<group>";

View file

@ -41,6 +41,7 @@
- (void)dealloc - (void)dealloc
{ {
[configuration release]; [configuration release];
[super dealloc];
} }
- (id)init - (id)init

File diff suppressed because one or more lines are too long

View file

@ -1,12 +1,74 @@
body { body {
line-height: 1.6;
font-size: 17px;
font-family: 'Lucida Grande', Helvetica, Arial;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
margin: 0; margin: 0;
background: #f6f6f6; background: #f6f6f6;
} }
.NB-story-author {
color: #969696;
text-transform: uppercase;
margin: 4px 8px 0px 0;
text-shadow: 0 1px 0 #F9F9F9;
float: left;
}
.NB-story-tags {
overflow: hidden;
padding: 5px 0 0 0;
text-transform: uppercase;
}
.NB-story-tag {
float: left;
font-weight: normal;
padding: 0px 4px 0px;
margin: 0px 4px 4px 0;
background-color: #C6CBC3;
color: #505050;
text-shadow: 0 1px 0 #E7E7E7;
-webkit-border-radius: 4px;
}
.NB-story-date {
color: #454D6C;
}
/* FONT RENDERING */
body {
line-height: 1.6em;
font-size: 16px;
}
.NB-san-serif {
font-family: Helvetica;
}
.NB-serif {
font-family: georgia;
}
.NB-story-author {
font-size: 10px;
line-height: 12px
}
.NB-story-tags {
line-height: 12px;
}
.NB-story-tag {
font-size: 9px;
}
.NB-story-date {
font-size: 11px;
line-height: 13px;
}
/* END: FONT RENDERING */
h1, h2, h3, h4, h5, h6, div, table, span, pre, code { h1, h2, h3, h4, h5, h6, div, table, span, pre, code {
overflow: auto; overflow: auto;
} }
@ -41,7 +103,7 @@ small {
.NB-header { .NB-header {
font-size: 22px; font-size: 22px;
line-height: 29px; line-height: 1.1em;
font-weight: 600; font-weight: 600;
background-color: #E0E0E0; background-color: #E0E0E0;
border-bottom: 1px solid #A0A0A0; border-bottom: 1px solid #A0A0A0;
@ -59,10 +121,6 @@ small {
display: block; display: block;
} }
.NB-story img.NB-tracker {
}
.NB-story img { .NB-story img {
max-width: 572px !important; max-width: 572px !important;
margin: 0 auto; margin: 0 auto;
@ -97,44 +155,6 @@ small {
margin: 30px 90px !important; margin: 30px 90px !important;
} }
.NB-story-author {
color: #969696;
font-size: 10px;
text-transform: uppercase;
margin: 4px 8px 0px 0;
text-shadow: 0 1px 0 #F9F9F9;
float: left;
line-height: 12px
}
.NB-story-tags {
overflow: hidden;
line-height: 12px;
padding: 5px 0 0 0;
text-transform: uppercase;
}
.NB-story-tag {
float: left;
font-size: 10px;
font-weight: normal;
font-size: 9px;
padding: 0px 4px 0px;
margin: 0px 4px 4px 0;
background-color: #C6CBC3;
color: #505050;
text-shadow: 0 1px 0 #E7E7E7;
-webkit-border-radius: 4px;
}
.NB-story-date {
font-size: 11px;
color: #454D6C;
line-height: 13px;
}
.NB-story-title { .NB-story-title {
clear: left; clear: left;
margin: 8px 0 4px; margin: 8px 0 4px;

View file

@ -15,7 +15,6 @@ Zepto(function($) {
$img.parent().addClass('NB-contains-image') $img.parent().addClass('NB-contains-image')
} }
var width = $(img).width(); var width = $(img).width();
console.log('width is' + width);
if ($(img).attr('src').indexOf('feedburner') != -1) { if ($(img).attr('src').indexOf('feedburner') != -1) {
$(img).addClass('NB-feedburner'); $(img).addClass('NB-feedburner');
} else if (width > 300) { } else if (width > 300) {