uislider

iOS - iPhone : UISlider track image disappearing randomly

余生颓废 提交于 2019-12-23 11:59:09
问题 I have a customized UISlider which has its track image disappear sometimes. It happens at random and when its parent view controller is pushed to visible (I never see it actually disappear). Here is my code for setting up the UISlider: timeSlider = [[UISlider alloc] initWithFrame:CGRectMake(55, 8, 210, 23)]; timeSlider.backgroundColor = [UIColor clearColor]; UIImage *blutrackImg = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluetrack" ofType:@"png"]];

How do I place a slider value in label?

て烟熏妆下的殇ゞ 提交于 2019-12-23 03:00:30
问题 I am quite new to Xcode and I am having trouble placing the value of a slider in a label when the slider is value is changed. Here is my code: Header file: @interface ViewTwoViewController : UIViewController { IBOutlet UISlider *slider; IBOutlet UILabel *sliderLabel; } -(IBAction)sliderValue:(id)sender; and here is my m file: -(IBAction)sliderValue:(UISlider *)sender { sliderLabel.text = [NSString stringWithFormat:@"%g", slider.value]; } I am not 100% sure why the value isn't updating? I am

iOS - How to slow down UISlider animation?

社会主义新天地 提交于 2019-12-23 02:43:14
问题 I'm trying to slow down the animation of the UISlider when changing values. So far, I've tried the old UIView animation method: [UIView beginAnimations:@"slider" context:nil]; [UIView setAnimationDuration:5.0]; [self.slider setValue:2 animated:YES]; [UIView commitAnimations]; And the new blocks based method: [UIView animateWithDuration:5.0 animations:^{ [self.slider setValue:2 animated:YES]; }]; I've tried with and without the animated:YES value set. In all cases, the slider simply animates

Two swift functions increasing compiling time dramatically

风格不统一 提交于 2019-12-22 22:47:47
问题 After going back and reading my app's build logs, there seems to be a strange issue where two (relatively) simple functions are both increasing the compiling time by one minute each (58 & 53 seconds respectively). This can be seen in my build logs below: These functions are in my CAAgeViewController and both reference a UISlider in my storyboard. They make sure that both the max and min sliders are at most within 1 year of each other, and either function sets a label to "18-24 Years" or

UISlider maximum values adjustments

怎甘沉沦 提交于 2019-12-22 12:18:12
问题 I am having three sliders and these shows the percentages for different elements what i need the max value of all is 100 (a+b+c=100). Now these all are dependent to each other and helps in making a pie chart. currently all can set to max value that is 100. how can make this dependency and max value logically. Thanx in advance. 回答1: In methods where you handle your sliders changes adjust maximum values for all sliders depending on current ones, e.g.: - (void) sliderChanged:(UISlider*)sender{

How can I control UISlider Value Changed-events frequency?

跟風遠走 提交于 2019-12-22 08:42:47
问题 I'm writing an iPhone app that is using two uisliders to control values that are sent using coreBluetooth. If I move the sliders quickly one value freezes at the receiver, presumably because the Value Changed events trigger so often that the write-commands stack up and eventually get thrown away. How can I make sure the events don't trigger too often? Edit: Here is a clarification of the problem; the bluetooth connection sends commands every 105ms. If the user generates a bunch of events

How to make UISlider output nice rounded numbers exponentially?

▼魔方 西西 提交于 2019-12-21 04:29:05
问题 I am implementing a UISlider a user can manipulate to set a distance. I have never used the CocoaTouch UISlider, but have used other frameworks sliders, usually there is a variable for setting the "step" and other "helper" properties. The documentation for the UISlider deals only with a max and min value, and the output is always a 6 decimal float with a linear relation to the position of the "slider nob". I guess I will have to implement the desired functionality step by step. To the user,

How to make UISlider default thumb to be smaller like the ones in the iOS control center

女生的网名这么多〃 提交于 2019-12-21 04:10:55
问题 I'm working on an app and I have a custom UISlider . However, I'm having some issues on how to make the default thumb to appear smaller like the ones in the iOS control center. Note that I want the same iOS thumb, not a custom thumb image. So far, I've tried thumbRect(forBounds...) but no luck. Any suggestions? 回答1: You can't change the size of the default thumb image, but UISlider has a method setThumbImage(_:for:) that will allow you to pass a similar, smaller image. In your view controller

UISlider ignores alpha when set to 0.5

人走茶凉 提交于 2019-12-21 03:57:38
问题 Why does the UISlider view ignore the alpha view when set to 0.5? Code: for (int i = 0; i < 3; i++) { UISlider *slider = [[[UISlider alloc] initWithFrame:CGRectMake(0, i * 30, 200, 30)] autorelease]; slider.alpha = 0.4 + (CGFloat)i / 10.0f; [window addSubview:slider]; } Result: The sliders have alpha values 0.4, 0.5 and 0.6. And as you can see the middle one with 0.5 is completely opaque. It seams to only occur with alpha 0.5. Have tested other UI controllers and they work as expected with

Animate UISlider smoothly

戏子无情 提交于 2019-12-21 01:21:31
问题 i want to animate an UISlider for e.g. 0.25 to 0.75 and back. This should show the user what is to do. i tried this: [self incrementCounter:[NSNumber numberWithInt:0]]; -(void) incrementCounter:(NSNumber *)i { [Slider setValue:[i floatValue]/1000]; [self performSelector:@selector(incrementCounter:) withObject:[NSNumber numberWithInt:i.intValue+1] afterDelay:0.001]; } but thats not so smooth... can i use transitions for this? [Slider setValue:1 animated:YES]; is to fast... [UIView