]> git.saurik.com Git - cydia.git/blobdiff - UICaboodle/RVBook.mm
iPhone 4 hi-res.
[cydia.git] / UICaboodle / RVBook.mm
index 28774ae3ac3d31e57fa7bc5573df3c7c88e3c89f..3fd525e081c8afbc90942710b60f74faf2c0b9ce 100644 (file)
@@ -65,6 +65,9 @@
     if (toolbar_ != nil)
         [toolbar_ setDelegate:nil];
 
+    for (RVPage *page in pages_)
+        [page setBook:nil];
+
     [pages_ release];
     [navbar_ release];
     [transition_ release];
 
         struct CGRect bounds = [self bounds];
         CGSize navsize = [UINavigationBar defaultSize];
-        CGRect navrect = {{0, 0}, navsize};
+        CGRect navrect = {{0, 0}, {bounds.size.width, navsize.height}};
 
         navbar_ = [[RVNavigationBar alloc] initWithFrame:navrect];
+        [navbar_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
         [self addSubview:navbar_];
 
         [navbar_ setBarStyle:0];
             bounds.origin.x, bounds.origin.y + navsize.height, bounds.size.width, bounds.size.height - navsize.height
         )];
 
+        [transition_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
+
         [self addSubview:transition_];
     } return self;
 }
     [pages_ addObject:page];
     [self reloadButtonsForPage:page];
 
-    [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
+    if ([navbar_ respondsToSelector:@selector(setAccessoryView:animate:removeOnPop:)])
+        [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
+    else
+        [navbar_ setAccessoryView:[page accessoryView] animate:animated];
 }
 
 - (void) pushPage:(RVPage *)page {
     [page setPageActive:YES];
     [self reloadButtonsForPage:page];
 
-    [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
+    if ([navbar_ respondsToSelector:@selector(setAccessoryView:animate:removeOnPop:)])
+        [navbar_ setAccessoryView:[page accessoryView] animate:animated removeOnPop:NO];
+    else
+        [navbar_ setAccessoryView:[page accessoryView] animate:animated];
 }
 
 - (void) setBackButtonTitle:(NSString *)title forPage:(RVPage *)page {
 }
 
 - (void) reloadData {
-    for (int i(0), e([pages_ count]); i != e; ++i) {
-        RVPage *page([pages_ objectAtIndex:(e - i - 1)]);
+    size_t count([pages_ count]);
+    for (size_t i(0); i != count; ++i) {
+        RVPage *page([pages_ objectAtIndex:(count - i - 1)]);
         [page reloadData];
     }
+
+    if (count != 0) {
+        RVPage *page([pages_ lastObject]);
+        [self reloadButtonsForPage:page];
+    }
+}
+
+- (void) reloadButtons {
+    size_t count([pages_ count]);
+    if (count != 0) {
+        RVPage *page([pages_ lastObject]);
+        [self reloadButtonsForPage:page];
+    }
 }
 
 - (CGRect) pageBounds {
 - (void) _leftButtonTitle:(NSString *&)leftButtonTitle style:(UINavigationButtonStyle &)leftButtonStyle forPage:(RVPage *)page {
     [super _leftButtonTitle:leftButtonTitle style:leftButtonStyle forPage:page];
     if ((cancel_ = leftButtonTitle == nil && [pages_ count] == 1)) {
-        leftButtonTitle = @"Cancel";
+        leftButtonTitle = [[NSBundle mainBundle] localizedStringForKey:@"CANCEL" value:nil table:nil];
         leftButtonStyle = UINavigationButtonStyleNormal;
     }
 }