uislider

Custom UISlider - Increase “hot spot” size

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 05:59:24
I have a custom UISlider that is relatively tough for big fingered people to grab hold of and slide due to the size of the "thumb image". Is there any way to increase the size of clickable / draggable area without altering the size of the image? Here's the code I have for creating the custom slider if that helps: [slider setMaximumTrackImage:[[UIImage imageNamed:@"max.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 20, 0, 20)] forState:UIControlStateNormal]; [slider setMinimumTrackImage:[[UIImage imageNamed:@"min.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 20, 0, 20)] forState

Image auto-rotates after using CIFilter

不羁岁月 提交于 2019-11-28 05:07:47
问题 I am writing an app that lets users take a picture and then edit it. I am working on implementing tools with UISliders for brightness/contrast/saturation and am using the Core Image Filter class to do so. When I open the app, I can take a picture and display it correctly. However, if I choose to edit a picture, and then use any of the described slider tools, the image will rotate counterclockwise 90 degrees. Here's the code in question: - (void)viewDidLoad { [super viewDidLoad]; // Do any

How to detect AVPlayer actually started to play in swift

泪湿孤枕 提交于 2019-11-28 02:31:14
问题 Hello I have set my UISlider minimum value to 0.00. Then I set it's max value in this way. self.viewPlayer.layer.addSublayer(playerLayer) let duration : CMTime = avPlayer.avPlayer.currentItem!.asset.duration let seconds : Float64 = CMTimeGetSeconds(duration) sliderBar.maximumValue=Float(seconds) sliderBar!.isContinuous = false sliderBar!.tintColor = UIColor.green But I am getting this exception *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:

iPhone : How to detect the end of slider drag?

£可爱£侵袭症+ 提交于 2019-11-27 17:39:37
How to detect the event when the user has ended the drag of a slider pointer? If you don't need any data inbetween drag, than you should simply set: [mySlider setContinuous: NO]; This way you will receive valueChanged event only when the user stops moving the slider. You can add an action that takes two parameters, sender and an event, for UIControlEventValueChanged: [slider addTarget:self action:@selector(onSliderValChanged:forEvent:) forControlEvents:UIControlEventValueChanged] Then check the phase of the touch object in your handler: - (void)onSliderValChanged:(UISlider*)slider forEvent:

How to enable “tap and slide” in a UISlider?

陌路散爱 提交于 2019-11-27 15:28:05
What I want to get is a UISlider which lets the user not only slide when he starts on its thumbRect , but also when he taps elsewhere. When the user taps on the slider but outside of the thumbRect , the slider should jump to that value and then still keeping up to the user's sliding gesture . What I have tried so far was implementing a subclass of UIGestureRecognizer like in this suggestion . It starts right then when a touch down somewhere outside the thumbRect occurs. The problem is that the slider sets its value but then further sliding gestures are ignored because the touch down recognizer

Increment UISlider by 1 in range 1 to 100

寵の児 提交于 2019-11-27 15:08:15
I am new to iPhone, How do I have my UISlider go from 1 to 100 in increments of 1 ? slider = [[UISlider alloc] init]; [slider addTarget:self action:@selector(sliderChange:) forControlEvents:UIControlEventValueChanged]; [slider setBackgroundColor:[UIColor clearColor]]; slider.minimumValue = 1; slider.maximumValue = 100; slider.continuous = YES; slider.value = 0.0; - (IBAction)sliderChange:(id)sender{ NSLog(@"slider.value=%f",slider.value); } When i slide my log shows... slider.value = 1.000000 slider.value = 1.123440 slider.value = 1.234550 slider.value = 1.345670 slider.value = 1.567890 . . .

Gesture problem: UISwipeGestureRecognizer + UISlider

不打扰是莪最后的温柔 提交于 2019-11-27 11:49:55
Got a gesture related problem. I implemented UISwipeGestureRecognizer to get swipe left and right events and that is working fine. However the problem I'm facing is that the UISlider's I have in the same view are not playing nice. The sliding motion of the sliders is being mistaken as a swipe left/right. Any one experienced this problem before, got any ideas how to correct it? Many thanks. Here is the code contained within the view controller: - (void)viewDidLoad { [super viewDidLoad]; //Setup handling of LEFT and RIGHT swipes UISwipeGestureRecognizer *recognizer; recognizer = [

iOS how to make slider stop at discrete points

独自空忆成欢 提交于 2019-11-27 10:28:25
问题 I would like to make a slider stop at discrete points that represent integers on a timeline. What's the best way to do this? I don't want any values in between. It would be great if the slider could "snap" to position at each discrete point as well. 回答1: To make the slider "stick" at specific points, your viewcontroller should, in the valueChanged method linked to from the slider, determine the appropriate rounded from the slider's value and then use setValue: animated: to move the slider to

UISlider and UIScrollView

蹲街弑〆低调 提交于 2019-11-27 10:10:48
问题 I have a UISlider as part of a view that is loaded into a UIScrollView with paging enabled. I've noticed an unexpected behavior. If the user tries to use the slider quickly (i.e. press and move) it "activates" the scroll view, causing the page to switch. However, if your press and hold for a second the slider "activates" and you can then adjust the slider value. This behavior is undesirable. What is the best way to make the UISlider responsive when loaded into a UIScrollView ? I've thought

How to put UISlider vertical?

廉价感情. 提交于 2019-11-27 09:44:58
问题 I want to put UISlider in vertically. I have no idea about this, so please help me for this. 回答1: You have to do this programaticaly. Assuming your UISlider is bound to a variable called slider , add this code in your viewDidLoad method in ViewController.m: - (void)viewDidLoad { [super viewDidLoad]; CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI * 0.5); slider.transform = trans; } Let me know if you need any more help on this.. 回答2: As of Xcode 4.2, you can sort of do the same