Skip to content

Commit

Permalink
v1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vfr committed Oct 24, 2013
1 parent 2db11a3 commit 7744bc7
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 132 deletions.
59 changes: 32 additions & 27 deletions Classes/FoldersViewController.m
@@ -1,6 +1,6 @@
//
// FoldersViewController.m
// Viewer v1.1.0
// Viewer v1.1.2
//
// Created by Julius Oklamcak on 2012-09-01.
// Copyright © 2011-2013 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -109,27 +109,40 @@ - (void)viewDidLoad

assert(delegate != nil); // Check delegate

self.view.backgroundColor = [UIColor grayColor];
self.view.backgroundColor = [UIColor grayColor]; // Neutral gray

CGRect viewRect = self.view.bounds; // View controller's view bounds
UIUserInterfaceIdiom userInterfaceIdiom = [UIDevice currentDevice].userInterfaceIdiom;

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
CGRect viewRect = self.view.bounds; UIView *fakeStatusBar = nil;

if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) // Small device
{
if ([self prefersStatusBarHidden] == NO) // Visible status bar
if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) // iOS 7+
{
viewRect.origin.y += STATUS_HEIGHT;
if ([self prefersStatusBarHidden] == NO) // Visible status bar
{
CGRect statusBarRect = self.view.bounds; // Status bar frame
statusBarRect.size.height = STATUS_HEIGHT; // Default status height
fakeStatusBar = [[UIView alloc] initWithFrame:statusBarRect]; // UIView
fakeStatusBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
fakeStatusBar.backgroundColor = [UIColor blackColor];
fakeStatusBar.contentMode = UIViewContentModeRedraw;
fakeStatusBar.userInteractionEnabled = NO;

viewRect.origin.y += STATUS_HEIGHT; viewRect.size.height -= STATUS_HEIGHT;
}
}
}

CGRect toolbarRect = viewRect; toolbarRect.size.height = TOOLBAR_HEIGHT;

theToolbar = [[UIXToolbarView alloc] initWithFrame:toolbarRect]; // At top
theToolbar = [[UIXToolbarView alloc] initWithFrame:toolbarRect]; // UIXToolbarView
[self.view addSubview:theToolbar]; // Add toolbar to view controller view

CGFloat toolbarWidth = theToolbar.bounds.size.width; // Toolbar width

CGFloat titleX = BUTTON_SPACE; CGFloat titleWidth = (toolbarWidth - (BUTTON_SPACE + BUTTON_SPACE));

if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)
if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) // Small device
{
UIImage *imageH = [UIImage imageNamed:@"Reader-Button-H"];
UIImage *imageN = [UIImage imageNamed:@"Reader-Button-N"];
Expand All @@ -141,8 +154,7 @@ - (void)viewDidLoad

CGFloat rightButtonX = (toolbarWidth - (CANCEL_BUTTON_WIDTH + BUTTON_SPACE)); // X

UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; // Cancel button

UIButton *cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; // UIButton
cancelButton.frame = CGRectMake(rightButtonX, BUTTON_Y, CANCEL_BUTTON_WIDTH, BUTTON_HEIGHT);
[cancelButton setTitle:NSLocalizedString(@"Cancel", @"button") forState:UIControlStateNormal];
[cancelButton setTitleColor:[UIColor colorWithWhite:0.0f alpha:1.0f] forState:UIControlStateNormal];
Expand All @@ -153,43 +165,36 @@ - (void)viewDidLoad
cancelButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
cancelButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];
cancelButton.exclusiveTouch = YES;

[theToolbar addSubview:cancelButton]; // Add to toolbar
[theToolbar addSubview:cancelButton]; // Add button to toolbar
}
else // Large device
{
self.contentSizeForViewInPopover = CGSizeMake(MAXIMUM_TABLE_WIDTH, MAXIMUM_TABLE_HEIGHT);
}

CGRect titleRect = CGRectMake(titleX, TITLE_Y, titleWidth, TITLE_HEIGHT);

theTitleLabel = [[UILabel alloc] initWithFrame:titleRect];

theTitleLabel = [[UILabel alloc] initWithFrame:titleRect]; // UILabel
theTitleLabel.textAlignment = NSTextAlignmentCenter;
theTitleLabel.font = [UIFont systemFontOfSize:19.0f];
theTitleLabel.textColor = [UIColor colorWithWhite:0.0f alpha:1.0f];
theTitleLabel.shadowColor = [UIColor colorWithWhite:0.65f alpha:1.0f];
theTitleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
theTitleLabel.backgroundColor = [UIColor clearColor];
theTitleLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);

theTitleLabel.text = NSLocalizedString(@"Folders", @"title");

[theToolbar addSubview:theTitleLabel]; // Add title to toolbar

[self.view addSubview:theToolbar]; // Add toolbar to controller view

CGRect tableRect = viewRect; tableRect.origin.y += TOOLBAR_HEIGHT; tableRect.size.height -= TOOLBAR_HEIGHT;

theTableView = [[UITableView alloc] initWithFrame:tableRect]; // Rest of view

theTableView = [[UITableView alloc] initWithFrame:tableRect]; // UITableView
theTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

theTableView.backgroundColor = [UIColor whiteColor]; theTableView.rowHeight = TABLE_CELL_HEIGHT;
theTableView.dataSource = self; theTableView.delegate = self; // UITableViewDelegate
[self.view insertSubview:theTableView belowSubview:theToolbar];

theTableView.dataSource = self; theTableView.delegate = self; // Set the delegates to self

[self.view addSubview:theTableView];
if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) // Small device
{
if (fakeStatusBar != nil) [self.view addSubview:fakeStatusBar]; // Add status bar background view
}
}

- (void)viewWillAppear:(BOOL)animated
Expand Down
58 changes: 31 additions & 27 deletions Classes/HelpViewController.m
@@ -1,6 +1,6 @@
//
// HelpViewController.m
// Viewer v1.1.0
// Viewer v1.1.2
//
// Created by Julius Oklamcak on 2012-09-01.
// Copyright © 2011-2013 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -84,27 +84,40 @@ - (void)viewDidLoad

assert(delegate != nil); // Check delegate

self.view.backgroundColor = [UIColor grayColor];
self.view.backgroundColor = [UIColor grayColor]; // Neutral gray

CGRect viewRect = self.view.bounds; // View controller's view bounds
UIUserInterfaceIdiom userInterfaceIdiom = [UIDevice currentDevice].userInterfaceIdiom;

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
CGRect viewRect = self.view.bounds; UIView *fakeStatusBar = nil;

if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) // Small device
{
if ([self prefersStatusBarHidden] == NO) // Visible status bar
if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) // iOS 7+
{
viewRect.origin.y += STATUS_HEIGHT;
if ([self prefersStatusBarHidden] == NO) // Visible status bar
{
CGRect statusBarRect = self.view.bounds; // Status bar frame
statusBarRect.size.height = STATUS_HEIGHT; // Default status height
fakeStatusBar = [[UIView alloc] initWithFrame:statusBarRect]; // UIView
fakeStatusBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
fakeStatusBar.backgroundColor = [UIColor blackColor];
fakeStatusBar.contentMode = UIViewContentModeRedraw;
fakeStatusBar.userInteractionEnabled = NO;

viewRect.origin.y += STATUS_HEIGHT; viewRect.size.height -= STATUS_HEIGHT;
}
}
}

CGRect toolbarRect = viewRect; toolbarRect.size.height = TOOLBAR_HEIGHT;

theToolbar = [[UIXToolbarView alloc] initWithFrame:toolbarRect]; // At top
theToolbar = [[UIXToolbarView alloc] initWithFrame:toolbarRect]; // UIXToolbarView
[self.view addSubview:theToolbar]; // Add toolbar to view controller view

CGFloat toolbarWidth = theToolbar.bounds.size.width; // Toolbar width

CGFloat titleX = BUTTON_SPACE; CGFloat titleWidth = (toolbarWidth - (BUTTON_SPACE + BUTTON_SPACE));

if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)
if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) // Small device
{
UIImage *imageH = [UIImage imageNamed:@"Reader-Button-H"];
UIImage *imageN = [UIImage imageNamed:@"Reader-Button-N"];
Expand All @@ -117,7 +130,6 @@ - (void)viewDidLoad
CGFloat rightButtonX = (toolbarWidth - (CLOSE_BUTTON_WIDTH + BUTTON_SPACE)); // X

UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; // Close button

closeButton.frame = CGRectMake(rightButtonX, BUTTON_Y, CLOSE_BUTTON_WIDTH, BUTTON_HEIGHT);
[closeButton setTitle:NSLocalizedString(@"Close", @"button") forState:UIControlStateNormal];
[closeButton setTitleColor:[UIColor colorWithWhite:0.0f alpha:1.0f] forState:UIControlStateNormal];
Expand All @@ -128,48 +140,40 @@ - (void)viewDidLoad
closeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
closeButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];
closeButton.exclusiveTouch = YES;

[theToolbar addSubview:closeButton]; // Add to toolbar
[theToolbar addSubview:closeButton]; // Add button to toolbar
}
else // Large device
{
self.contentSizeForViewInPopover = CGSizeMake(MAXIMUM_HELP_WIDTH, MAXIMUM_HELP_HEIGHT);
}

NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];

NSString *name = [infoDictionary objectForKey:(NSString *)kCFBundleNameKey];

NSString *version = [infoDictionary objectForKey:(NSString *)kCFBundleVersionKey];

CGRect titleRect = CGRectMake(titleX, TITLE_Y, titleWidth, TITLE_HEIGHT);

theTitleLabel = [[UILabel alloc] initWithFrame:titleRect];

theTitleLabel.textAlignment = NSTextAlignmentCenter;
theTitleLabel.font = [UIFont systemFontOfSize:17.0f];
theTitleLabel.textColor = [UIColor colorWithWhite:0.0f alpha:1.0f];
theTitleLabel.shadowColor = [UIColor colorWithWhite:0.65f alpha:1.0f];
theTitleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
theTitleLabel.backgroundColor = [UIColor clearColor];
theTitleLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);

theTitleLabel.text = [NSString stringWithFormat:@"%@ v%@", name, version];

[theToolbar addSubview:theTitleLabel]; // Add title to toolbar

[self.view addSubview:theToolbar]; // Add toolbar to controller view

CGRect helpRect = viewRect; helpRect.origin.y += TOOLBAR_HEIGHT; helpRect.size.height -= TOOLBAR_HEIGHT;

theWebView = [[UIWebView alloc] initWithFrame:helpRect]; // Rest of view

theWebView.scalesPageToFit = NO;
theWebView.dataDetectorTypes = UIDataDetectorTypeNone;
theWebView = [[UIWebView alloc] initWithFrame:helpRect]; // UIWebView
theWebView.dataDetectorTypes = UIDataDetectorTypeNone; theWebView.scalesPageToFit = NO;
theWebView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
theWebView.delegate = self;

theWebView.delegate = self; // UIWebViewDelegate
[self.view insertSubview:theWebView belowSubview:theToolbar];

if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) // Small device
{
if (fakeStatusBar != nil) [self.view addSubview:fakeStatusBar]; // Add status bar background view
}
}

- (void)viewWillAppear:(BOOL)animated
Expand Down
41 changes: 21 additions & 20 deletions Classes/LibraryViewController.m
@@ -1,6 +1,6 @@
//
// LibraryViewController.m
// Viewer v1.1.0
// Viewer v1.1.2
//
// Created by Julius Oklamcak on 2012-09-01.
// Copyright © 2011-2013 Julius Oklamcak. All rights reserved.
Expand Down Expand Up @@ -173,37 +173,38 @@ - (void)viewDidLoad

self.view.backgroundColor = [UIColor clearColor];

CGRect viewRect = self.view.bounds; // View controller's view bounds
CGRect scrollViewRect = self.view.bounds; UIView *fakeStatusBar = nil;

if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) // iOS 7+
{
if ([self prefersStatusBarHidden] == NO) // Visible status bar
{
viewRect.origin.y += STATUS_HEIGHT;
CGRect statusBarRect = self.view.bounds; // Status bar frame
statusBarRect.size.height = STATUS_HEIGHT; // Default status height
fakeStatusBar = [[UIView alloc] initWithFrame:statusBarRect]; // UIView
fakeStatusBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
fakeStatusBar.backgroundColor = [UIColor blackColor];
fakeStatusBar.contentMode = UIViewContentModeRedraw;
fakeStatusBar.userInteractionEnabled = NO;

scrollViewRect.origin.y += STATUS_HEIGHT; scrollViewRect.size.height -= STATUS_HEIGHT;
}
}

theScrollView = [[UIScrollView alloc] initWithFrame:viewRect]; // All

theScrollView.bounces = NO;
theScrollView.scrollsToTop = NO;
theScrollView.pagingEnabled = YES;
theScrollView.delaysContentTouches = NO;
theScrollView.showsVerticalScrollIndicator = NO;
theScrollView.showsHorizontalScrollIndicator = NO;
theScrollView.contentMode = UIViewContentModeRedraw;
theScrollView = [[UIScrollView alloc] initWithFrame:scrollViewRect]; // UIScrollView
theScrollView.autoresizesSubviews = NO; theScrollView.contentMode = UIViewContentModeRedraw;
theScrollView.showsHorizontalScrollIndicator = NO; theScrollView.showsVerticalScrollIndicator = NO;
theScrollView.scrollsToTop = NO; theScrollView.delaysContentTouches = NO; theScrollView.pagingEnabled = YES;
theScrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
theScrollView.backgroundColor = [UIColor clearColor];
theScrollView.userInteractionEnabled = YES;
theScrollView.autoresizesSubviews = NO;
theScrollView.delegate = self;

theScrollView.backgroundColor = [UIColor clearColor]; theScrollView.bounces = NO;
theScrollView.delegate = self; // UIScrollViewDelegate
[self.view addSubview:theScrollView];

updatingView = [[LibraryUpdatingView alloc] initWithFrame:viewRect]; // All

updatingView = [[LibraryUpdatingView alloc] initWithFrame:scrollViewRect]; // LibraryUpdatingView
[self.view addSubview:updatingView];

if (fakeStatusBar != nil) [self.view addSubview:fakeStatusBar]; // Add status bar background view

contentViews = [NSMutableArray new];
}

Expand Down
4 changes: 4 additions & 0 deletions HISTORY.md
@@ -1,6 +1,10 @@

## History

2013-10-24: Version 1.1.2

- iOS 7 status bar handling bug fixes.

2013-10-12: Version 1.1.1

- Changed 'unsafe_unretained' to 'weak'.
Expand Down

0 comments on commit 7744bc7

Please sign in to comment.