[dasher: 12/21] iOS: fix the speed slider



commit d9e2032c268feca1e8dfe77b6f791ca8cf37267c
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Fri Jul 8 19:31:27 2011 +0100

    iOS: fix the speed slider
    
    (broken by scrolling message-display)

 Src/iPhone/Classes/DasherAppDelegate.mm |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/Src/iPhone/Classes/DasherAppDelegate.mm b/Src/iPhone/Classes/DasherAppDelegate.mm
index ac13d69..9092863 100644
--- a/Src/iPhone/Classes/DasherAppDelegate.mm
+++ b/Src/iPhone/Classes/DasherAppDelegate.mm
@@ -136,7 +136,11 @@ static SModuleSettings _miscSettings[] = { //note iStep and string description a
   }
   textView.frame = textRect;
   webView.frame = textRect;
-  messageLabel.frame = CGRectMake(0.0, textRect.origin.y + textRect.size.height, mainSize.width, 0.0);
+  messageLabel.frame = CGRectMake(0.0, textRect.origin.y + textRect.size.height - messageLabel.frame.size.height, mainSize.width, messageLabel.frame.size.height);
+  //YEUCH but unfortunately I can find no way to (programmatically) get the proper height for a UISlider.
+  // Setting its height to 0 seems to be stored ok, but ends up with the slider being unresponsive -
+  // yet clearly rendered >0 pixels high onscreen...
+  speedSlider.frame = CGRectMake(0.0, textRect.origin.y + textRect.size.height-23.0, mainSize.width, 23.0);
   [NSObject cancelPreviousPerformRequestsWithTarget:messageLabel];
   if (glView) glView.frame=dashRect;
   return dashRect;
@@ -166,6 +170,7 @@ static SModuleSettings _miscSettings[] = { //note iStep and string description a
 	textView = [[[TextView alloc] init] autorelease];
   webView = [[[UIWebView alloc] init] autorelease];
   messageLabel = [[[UITextView alloc] init] autorelease];
+  speedSlider = [[[UISlider alloc] init] autorelease];
   tools = [[UIToolbar alloc] init]; //retain a reference (until dealloc) because of rotation
 	glView = [[[EAGLView alloc] initWithFrame:[self doLayout:UIInterfaceOrientationPortrait] Delegate:self] autorelease];
   glView.multipleTouchEnabled = YES;
@@ -189,8 +194,6 @@ static SModuleSettings _miscSettings[] = { //note iStep and string description a
   messageLabel.contentInset = UIEdgeInsetsZero;
   messageLabel.hidden = YES;
 
-  speedSlider = [[[UISlider alloc] init] autorelease];
-  speedSlider.frame = messageLabel.frame;
   speedSlider.minimumValue=0.1; speedSlider.maximumValue=12.0;
   speedSlider.hidden = YES;
   



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]