Skip to content

Commit 64d2713

Browse files
author
Joey Lorich
committed
Move more relationships to the storyboard
1 parent 924e068 commit 64d2713

51 files changed

Lines changed: 434 additions & 509 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

EasyReader.xcodeproj/project.pbxproj

Lines changed: 323 additions & 308 deletions
Large diffs are not rendered by default.

EasyReader/Application/AppDelegates/EZRApplicationStyleService.m

Lines changed: 0 additions & 32 deletions
This file was deleted.

EasyReader/Application/Controllers/EZRRootViewController.m

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,74 +7,69 @@
77
//
88

99
#import "EZRRootViewController.h"
10-
1110
#import "EZRMenuViewController.h"
1211
#import "EZRHomeViewController.h"
1312

1413

14+
#pragma mark - MFSideMenuContainerViewController
1515

16-
//#import "UIViewController+NibLoader.h"
17-
18-
16+
/**
17+
* Category to enable access to the private menuContainerView property
18+
*/
1919
@interface MFSideMenuContainerViewController ()
2020

21+
/// The menu container view
2122
@property (nonatomic, strong) UIView *menuContainerView;
2223

2324
@end
2425

2526

27+
#pragma mark - Root view controller
28+
2629
@implementation EZRRootViewController
2730

2831
/**
2932
* Creates the menu contorllers and side menu
3033
*/
31-
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
32-
{
33-
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
34-
35-
if (self) {
36-
// Create view controller
37-
UIStoryboard *storyboard_home = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:[NSBundle mainBundle]];
38-
EZRHomeViewController *collections = [storyboard_home instantiateViewControllerWithIdentifier:@"Home"];
39-
_viewController_main = collections;
40-
41-
[self setViewControllers:@[_viewController_main]];
42-
}
43-
44-
return self;
34+
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
35+
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
36+
37+
if (self) {
38+
UIStoryboard *storyboard_home = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:[NSBundle mainBundle]];
39+
EZRHomeViewController *collections = [storyboard_home instantiateViewControllerWithIdentifier:@"Home"];
40+
_viewController_main = collections;
41+
42+
[self setViewControllers:@[_viewController_main]];
43+
}
44+
45+
return self;
4546
}
4647

47-
- (void)viewDidAppear:(BOOL)animated
48-
{
48+
/**
49+
* Disable the gesture recognizer on the left view controller so that it doesn't interfere with
50+
* swipe to delete on the feed menu tableview
51+
*/
52+
- (void)viewDidAppear:(BOOL)animated {
4953
[super viewDidAppear:animated];
5054

5155
MFSideMenuContainerViewController *container = (MFSideMenuContainerViewController *)[[[[UIApplication sharedApplication] delegate] window] rootViewController];
52-
// container.menuContainerView.gestureRecognizers
53-
5456

5557
for (UIGestureRecognizer *recognizer in container.menuContainerView.gestureRecognizers) {
5658
[recognizer setEnabled:NO];
57-
// [container.menuContainerView removeGestureRecognizer:recognizer];
5859
}
59-
6060
}
6161

6262
/**
6363
* If the left menu is open, it closes it
6464
* Otherwise it opens to the left menu
6565
*/
66-
- (void) toggleLeftMenu
67-
{
68-
if (self.menuContainerViewController.menuState == MFSideMenuStateLeftMenuOpen)
69-
{
70-
[self.menuContainerViewController setMenuState:MFSideMenuStateClosed completion:^{}];
71-
72-
}
73-
else
74-
{
75-
[self.menuContainerViewController toggleLeftSideMenuCompletion:^{}];
76-
}
66+
- (void) toggleLeftMenu {
67+
if (self.menuContainerViewController.menuState == MFSideMenuStateLeftMenuOpen) {
68+
[self.menuContainerViewController setMenuState:MFSideMenuStateClosed completion:^{}];
69+
70+
} else {
71+
[self.menuContainerViewController toggleLeftSideMenuCompletion:^{}];
72+
}
7773
}
7874

79-
8075
@end

EasyReader/Application/Controllers/Home/FeedItemCollectionView/EZRFeedItemCollectionView.h renamed to EasyReader/Application/Controllers/Home/CollectionView/EZRFeedItemCollectionView.h

File renamed without changes.

EasyReader/Application/Controllers/Home/FeedItemCollectionView/EZRFeedItemCollectionView.m renamed to EasyReader/Application/Controllers/Home/CollectionView/EZRFeedItemCollectionView.m

File renamed without changes.

EasyReader/Application/Controllers/Home/FeedItemCollectionView/EZRFeedItemCollectionViewCell.h renamed to EasyReader/Application/Controllers/Home/CollectionView/EZRFeedItemCollectionViewCell.h

File renamed without changes.

EasyReader/Application/Controllers/Home/FeedItemCollectionView/EZRFeedItemCollectionViewCell.m renamed to EasyReader/Application/Controllers/Home/CollectionView/EZRFeedItemCollectionViewCell.m

File renamed without changes.

EasyReader/Application/Controllers/Home/EZRHomeCollectionViewDelegate.h renamed to EasyReader/Application/Controllers/Home/CollectionView/EZRHomeCollectionViewDelegate.h

File renamed without changes.

EasyReader/Application/Controllers/Home/EZRHomeCollectionViewDelegate.m renamed to EasyReader/Application/Controllers/Home/CollectionView/EZRHomeCollectionViewDelegate.m

File renamed without changes.

EasyReader/Application/Controllers/Home/EZRHomeViewController.m

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#import "EZRFeedImageService.h"
3434
#import "EZRHomeCollectionViewDelegate.h"
3535
#import "EZRHomeScrollViewDelegate.h"
36-
#import "EZRHomePageControlDelegate.h"
3736
#import "EZRHomePageControlDataSource.h"
3837
#import "EZRHomeWebViewDelegate.h"
3938
#import "EZRCurrentFeedsProvider.h"
@@ -62,6 +61,8 @@ @interface EZRHomeViewController()
6261
/// The home collection view delegate
6362
@property (nonatomic, weak) IBOutlet EZRHomeCollectionViewDelegate *collectionViewDelegate;
6463

64+
/// The delegate for the web view
65+
@property (nonatomic, weak) IBOutlet EZRHomeWebViewDelegate *webViewDelegate;
6566

6667

6768

@@ -70,19 +71,6 @@ @interface EZRHomeViewController()
7071

7172
@implementation EZRHomeViewController
7273
{
73-
/// The collectionView delegate
74-
/// The scroll view delegate
75-
EZRHomeScrollViewDelegate *scrollViewDelegate;
76-
77-
/// The page control delegate
78-
EZRHomePageControlDelegate *pageControlDelegate;
79-
80-
/// The page control data source
81-
EZRHomePageControlDataSource *pageControlDataSource;
82-
83-
/// The delegate for the web view
84-
EZRHomeWebViewDelegate *webViewDelegate;
85-
8674
/// The data source for the collection view
8775
CLDArrayCollectionViewDataSource *collectionViewArrayDataSource;
8876

@@ -146,7 +134,6 @@ - (void)viewDidLoad
146134

147135
[[EZRGoogleAnalyticsService shared] sendView:@"Home"];
148136

149-
[self setUpPageControl];
150137
[self setUpVerticalScrollView];
151138
[self setUpCollectionView];
152139
[self setUpWebView];
@@ -171,15 +158,9 @@ - (void)viewDidLoad
171158
object:nil];
172159

173160
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
174-
BOOL ok;
161+
175162
NSError *setCategoryError = nil;
176-
ok = [audioSession setCategory:AVAudioSessionCategoryPlayback
177-
error:&setCategoryError];
178-
if (!ok) {
179-
NSLog(@"%s setCategoryError=%@", __PRETTY_FUNCTION__, setCategoryError);
180-
}
181-
182-
//[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
163+
[audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
183164
}
184165

185166
/**
@@ -219,18 +200,6 @@ -(BOOL)shouldAutorotate {
219200

220201
#pragma mark - Setup methods
221202

222-
/**
223-
* Sets up the page control
224-
*/
225-
- (void) setUpPageControl
226-
{
227-
pageControlDelegate = [[EZRHomePageControlDelegate alloc] initWithController:self];
228-
pageControlDataSource = [[EZRHomePageControlDataSource alloc] init];
229-
230-
self.pageControl_itemIndicator.delegate = pageControlDelegate;
231-
self.pageControl_itemIndicator.datasource = pageControlDataSource;
232-
}
233-
234203
/**
235204
* Sets up vertical scroll view on controller start up
236205
*/
@@ -243,6 +212,9 @@ -(void)setUpVerticalScrollView
243212
[self.scrollView_vertical setContentOffset:CGPointMake(0, 60)];
244213
}
245214

215+
/**
216+
* Sets up the share toolbar
217+
*/
246218
- (void)setUpShareToolbar {
247219
[self.scrollView_vertical insertSubview:self.socialShareToolbar belowSubview:self.webView_feedItem];
248220
self.socialShareToolbar.backgroundTransparent = YES;
@@ -287,7 +259,7 @@ -(void)setUpWebView
287259
[self.webView_feedItem setBackgroundColor:[UIColor blackColor]];
288260
[self.scrollView_vertical addSubview:self.webView_feedItem];
289261

290-
self.webView_feedItem.scrollView.delegate = webViewDelegate;
262+
self.webView_feedItem.scrollView.delegate = self.webViewDelegate;
291263

292264
self.webView_feedItem.multipleTouchEnabled = YES;
293265
self.webView_feedItem.scalesPageToFit = YES;

0 commit comments

Comments
 (0)