diff --git a/BakerView/BakerBook.h b/BakerView/BakerBook.h index 0404a827..fd2782c4 100644 --- a/BakerView/BakerBook.h +++ b/BakerView/BakerBook.h @@ -67,6 +67,7 @@ @property (copy, nonatomic) NSNumber *bakerPageTurnSwipe; @property (copy, nonatomic) NSNumber *bakerMediaAutoplay; +@property (copy, nonatomic) NSNumber *bakerIndexFullscreen; @property (copy, nonatomic) NSNumber *bakerIndexWidth; @property (copy, nonatomic) NSNumber *bakerIndexHeight; @property (copy, nonatomic) NSNumber *bakerIndexBounce; diff --git a/BakerView/BakerBook.m b/BakerView/BakerBook.m index 1ac00de5..34954b73 100644 --- a/BakerView/BakerBook.m +++ b/BakerView/BakerBook.m @@ -68,6 +68,7 @@ @implementation BakerBook @synthesize bakerPageTurnSwipe; @synthesize bakerMediaAutoplay; +@synthesize bakerIndexFullscreen; @synthesize bakerIndexWidth; @synthesize bakerIndexHeight; @synthesize bakerIndexBounce; @@ -198,6 +199,7 @@ - (BOOL)loadBookData:(NSDictionary *)bookData self.bakerPageTurnSwipe = [bookData objectForKey:@"-baker-page-turn-swipe"]; self.bakerMediaAutoplay = [bookData objectForKey:@"-baker-media-autoplay"]; + self.bakerIndexFullscreen = [bookData objectForKey:@"-baker-index-fullscreen"]; self.bakerIndexWidth = [bookData objectForKey:@"-baker-index-width"]; self.bakerIndexHeight = [bookData objectForKey:@"-baker-index-height"]; self.bakerIndexBounce = [bookData objectForKey:@"-baker-index-bounce"]; @@ -247,6 +249,9 @@ - (void)loadBookJSONDefault if (self.bakerIndexBounce == nil) { self.bakerIndexBounce = [NSNumber numberWithBool:NO]; } + if (self.bakerIndexFullscreen == nil) { + self.bakerIndexFullscreen = [NSNumber numberWithBool:NO]; + } if (self.bakerStartAtPage == nil) { self.bakerStartAtPage = [NSNumber numberWithInt:1]; } @@ -363,6 +368,7 @@ - (BOOL)validateNumber:(NSNumber *)number forParam:(NSString *)param @"-baker-page-turn-tap", @"-baker-page-turn-swipe", @"-baker-media-autoplay", + @"-baker-index-fullscreen", @"-baker-index-width", @"-baker-index-height", @"-baker-index-bounce", @@ -461,6 +467,7 @@ - (void)dealloc [bakerPageTurnSwipe release]; [bakerMediaAutoplay release]; + [bakerIndexFullscreen release]; [bakerIndexWidth release]; [bakerIndexHeight release]; [bakerIndexBounce release]; diff --git a/BakerView/IndexViewController.h b/BakerView/IndexViewController.h index bfe15cc4..d5942274 100644 --- a/BakerView/IndexViewController.h +++ b/BakerView/IndexViewController.h @@ -46,6 +46,7 @@ int actualIndexWidth; int actualIndexHeight; + BOOL fullscreen; BOOL disabled; BOOL loadedFromBundle; @@ -59,6 +60,7 @@ - (void)setBounceForWebView:(UIWebView *)webView bounces:(BOOL)bounces; - (void)setPageSizeForOrientation:(UIInterfaceOrientation)orientation; - (BOOL)isIndexViewHidden; +- (BOOL)isFullscreen; - (BOOL)isDisabled; - (void)setIndexViewHidden:(BOOL)hidden withAnimation:(BOOL)animation; - (void)willRotate; diff --git a/BakerView/IndexViewController.m b/BakerView/IndexViewController.m index ffcdc872..0085aa3c 100644 --- a/BakerView/IndexViewController.m +++ b/BakerView/IndexViewController.m @@ -45,6 +45,7 @@ - (id)initWithBook:(BakerBook *)bakerBook fileName:(NSString *)name webViewDeleg webViewDelegate = delegate; disabled = NO; + fullscreen = [self isFullscreen]; indexWidth = 0; indexHeight = 0; @@ -105,14 +106,24 @@ - (void)setPageSizeForOrientation:(UIInterfaceOrientation)orientation { } - (void)setActualSize { - actualIndexWidth = MIN(indexWidth, pageWidth); - actualIndexHeight = MIN(indexHeight, pageHeight); + if (fullscreen) { + actualIndexWidth = pageWidth; + actualIndexHeight = pageHeight; + } else { + actualIndexWidth = MIN(indexWidth, pageWidth); + actualIndexHeight = MIN(indexHeight, pageHeight); + } + } - (BOOL)isIndexViewHidden { return [UIApplication sharedApplication].statusBarHidden; } +- (BOOL)isFullscreen { + return (BOOL)[book.bakerIndexFullscreen boolValue]; +} + - (BOOL)isDisabled { return disabled; } @@ -129,7 +140,7 @@ - (void)setIndexViewHidden:(BOOL)hidden withAnimation:(BOOL)animation { if ([self stickToLeft]) { frame = CGRectMake(0, [self trueY] + pageHeight - actualIndexHeight, actualIndexWidth, actualIndexHeight); } else { - frame = CGRectMake(0, [self trueY] + pageHeight - indexHeight, actualIndexWidth, actualIndexHeight); + frame = CGRectMake(0, [self trueY] + pageHeight - actualIndexHeight, actualIndexWidth, actualIndexHeight); } } @@ -221,18 +232,20 @@ - (void)loadContent { } } -(void)webViewDidFinishLoad:(UIWebView *)webView { - id width = book.bakerIndexWidth; - id height = book.bakerIndexHeight; + if (!fullscreen) { + id width = book.bakerIndexWidth; + id height = book.bakerIndexHeight; - if (width != nil) { - indexWidth = (int)[width integerValue]; - } else { - indexWidth = [self sizeFromContentOf:webView].width; - } - if (height != nil) { - indexHeight = (int)[height integerValue]; - } else { - indexHeight = [self sizeFromContentOf:webView].height; + if (width != nil) { + indexWidth = (int)[width integerValue]; + } else { + indexWidth = [self sizeFromContentOf:webView].width; + } + if (height != nil) { + indexHeight = (int)[height integerValue]; + } else { + indexHeight = [self sizeFromContentOf:webView].height; + } } cachedContentSize = indexScrollView.contentSize; @@ -251,6 +264,9 @@ -(void)webViewDidFinishLoad:(UIWebView *)webView { } - (BOOL)stickToLeft { + if (fullscreen) { + return NO; + } return (actualIndexHeight > actualIndexWidth); }