Domanda

I was using InAppSettings to manage my settings but it stopped working in iOS 7 and I couldn't figure out why. So I set out to build my own simple settings tableView. In cellForRowAtIndexPath: I make a slider and add it to my cell like this:

UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(really ugly frame code)];
slider.minimumValue = 0;
slider.maximumValue = 7;
slider.value = 4;
slider.userInteractionEnabled = YES;
[slider addTarget:self action:@selector(slide:) forControlEvents:UIControlEventValueChanged];

[cell addSubview:slider];

The slider shows up perfectly, but I can't interact with it! No matter what I do it won't move. And the target action never gets fired either. The exact same bug I was having with InAppSettings to begin with.

It feels like I am missing something simple, anybody see this before?

È stato utile?

Soluzione

Weird. I guess I was initializing the UISlider incorrectly. This code works.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top