]> git.saurik.com Git - cydia.git/commitdiff
Improved positioning and rotation support of Settings view.
authorGrant Paul <chpwn@chpwn.com>
Sun, 3 Oct 2010 09:01:31 +0000 (02:01 -0700)
committerJay Freeman <saurik@Jay-Freemans-MacBook-Pro.local>
Mon, 4 Oct 2010 07:12:22 +0000 (00:12 -0700)
Cydia.mm

index f8668cbaa9d4b196751aff916843270212f05064..eb17d6a13ceed4f7565099b47dd606f64da0a6c7 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -7529,6 +7529,7 @@ freeing the view controllers on tab change */
         }
         
         [segment_ addTarget:self action:@selector(segmentChanged:) forControlEvents:UIControlEventValueChanged];
+        [self resizeSegmentedControl];
         
         table_ = [[UITableView alloc] initWithFrame:[[self view] bounds] style:UITableViewStyleGrouped];
         [table_ setAutoresizingMask:UIViewAutoresizingFlexibleBoth];
@@ -7539,11 +7540,23 @@ freeing the view controllers on tab change */
     } return self;
 }
 
+- (void) resizeSegmentedControl {
+    CGFloat width = [[self view] frame].size.width;
+    [segment_ setFrame:CGRectMake(width / 32.0f, 0, width - (width / 32.0f * 2.0f), 44.0f)];
+}
+
 - (void) viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
     
-    CGFloat width = [[self view] frame].size.width;
-    [segment_ setFrame:CGRectMake(width / 32.0f, 0, width - (width / 32.0f * 2.0f), 44.0f)];
+    [self resizeSegmentedControl];
+}
+
+- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
+    [self resizeSegmentedControl];
+}
+
+- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
+    [self resizeSegmentedControl];
 }
 
 - (void) save {
@@ -7593,7 +7606,8 @@ freeing the view controllers on tab change */
 }
 
 - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
-    return 5;
+    // XXX: For not having a single cell in the table, this sure is a lot of sections.
+    return 6;
 }
 
 - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@@ -7817,8 +7831,7 @@ freeing the view controllers on tab change */
     [[root_ selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation];
 }
 
-- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
-{
+- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
     // XXX: fix Apple's layout bug
     [[root_ selectedViewController] _updateLayoutForStatusBarAndInterfaceOrientation];
 }