URBSegmentedControl
URBSegmentedControl copied to clipboard
cant select items when height in vertical layout is high
I am doing something like this: (i am repeating elements just for the sake of showing a lot of elements) NSArray *titles = [NSArray arrayWithObjects:[@"YES" uppercaseString], [@"NO" uppercaseString],[@"YES" uppercaseString], [@"NO" uppercaseString],[@"YES" uppercaseString], [@"NO" uppercaseString],[@"YES" uppercaseString],[@"YES" uppercaseString], nil];
URBSegmentedControl *control = [[URBSegmentedControl alloc] initWithItems:titles];
control.frame = CGRectMake((self.view.frame.size.width/2)-100, 5, 200.0, [titles count]*80);
From element 0 to element 4 i can select without problems.. but 5,6 and 7 its unselectable.. but if i change size from 80 to 40 .. it all works..
I cant find the reason for this !
@diegoescobar79 I was able to setup a control similar to that you're having an issues with using the same array of titles you provided and item selection worked without issues regardless of the control's height. Check and verify that your control's frame doesn't extend beyond the bounds of its superview which can prevent it from receiving the necessary touch events.
Thanks for answering. I have the control in a scrollview and realized that if the control goed beyond the view when i scroll to see it, seems that the scrollview steals the touches from it.. U know something about this issues? Regards
Enviado desde mi iPhone
El 21/01/2015, a las 8:28 p.m., Nicholas Shipes [email protected] escribió:
@diegoescobar79 I was able to setup a control similar to that you're having an issues with using the same array of titles you provided and item selection worked without issues regardless of the control's height. Check and verify that your control's frame doesn't extend beyond the bounds of its superview which can prevent it from receiving the necessary touch events.
— Reply to this email directly or view it on GitHub.
Have you debugged your view hierarchy to determine if the control is extending beyond one of its superviews? Or is your view hierarchy just something like UIViewController.view -> UIScrollView -> URBSegmentedControl?
It still sounds like the control's frame extends beyond its superview's bounds as I'm not aware of any issues with a scroll view blocking touch events on its subviews. If you could provide more code from your view setup and implementation that may help me better figure out the cause.