summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-11-01 22:52:23 +0100
committerTor Andersson <tor.andersson@artifex.com>2011-11-01 23:46:58 +0100
commit91b15d827ad0489f62490ee34b2af7dc9aea377e (patch)
tree37cba309914ab70f0d6c510a22f352ad99c80f9e /ios
parent76d9ade707c824aba28861be478cba6ae61620f2 (diff)
downloadmupdf-91b15d827ad0489f62490ee34b2af7dc9aea377e.tar.xz
Dynamically change navigation bar titles based on context.
Diffstat (limited to 'ios')
-rw-r--r--ios/main.m13
1 files changed, 7 insertions, 6 deletions
diff --git a/ios/main.m b/ios/main.m
index 7ec452e5..fcb3a601 100644
--- a/ios/main.m
+++ b/ios/main.m
@@ -207,7 +207,7 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen)
- (void) viewWillAppear: (BOOL)animated
{
- [self setTitle: @"MuPDF"];
+ [self setTitle: @"PDF and XPS Documents"];
[self reload];
printf("library viewWillAppear (starting reload timer)\n");
timer = [NSTimer timerWithTimeInterval: 1
@@ -218,6 +218,7 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen)
- (void) viewWillDisappear: (BOOL)animated
{
+ [self setTitle: @"Library"];
printf("library viewWillDisappear (stopping reload timer)\n");
[timer invalidate];
timer = nil;
@@ -311,6 +312,7 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen)
target = aTarget; // only keep a weak reference, to avoid retain cycles
titles = [aTitles retain];
pages = [aPages retain];
+ [[self tableView] setSeparatorStyle: UITableViewCellSeparatorStyleNone];
}
return self;
}
@@ -405,14 +407,11 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen)
return nil;
}
- [self setTitle: [nsfilename lastPathComponent]];
-
NSMutableArray *titles = [[NSMutableArray alloc] init];
NSMutableArray *pages = [[NSMutableArray alloc] init];
loadOutline(titles, pages, xref);
if ([titles count]) {
outline = [[MuOutlineController alloc] initWithTarget: self titles: titles pages: pages];
- [[outline tableView] setSeparatorStyle: UITableViewCellSeparatorStyleNone];
[[self navigationItem] setRightBarButtonItem:
[[UIBarButtonItem alloc]
initWithBarButtonSystemItem: UIBarButtonSystemItemBookmarks
@@ -478,12 +477,14 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen)
width = size.width;
height = size.height;
+ [self setTitle: [key lastPathComponent]];
+
[slider setValue: current];
[indicator setText: [NSString stringWithFormat: @" %d of %d ", current+1, pdf_count_pages(xref)]];
[canvas setContentInset: UIEdgeInsetsZero];
- [canvas setContentSize: CGSizeMake(pdf_count_pages(xref) * width - GAP, height)];
+ [canvas setContentSize: CGSizeMake(pdf_count_pages(xref) * width, height)];
[canvas setContentOffset: CGPointMake(current * width, 0)];
[wrapper setWidth: width - GAP - 24];
@@ -498,8 +499,8 @@ static UIImage *renderPage(pdf_xref *xref, int number, CGSize screen)
- (void) viewWillDisappear: (BOOL)animated
{
+ [self setTitle: @"Resume"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey: @"OpenDocumentKey"];
-
[[self navigationController] setToolbarHidden: YES animated: animated];
}