SDSegmentedControl
SDSegmentedControl copied to clipboard
SDSegmentedControl hard-freezes iOS devices
SDSegmentedControl manages to hard-freeze iOS (6.x), so that only a forced shutdown makes it work again. I have created a minimal example that puts the blame on a combination of arrowSize = 0.0 and adding segments at runtime. My theory is that one of the UIKit and/or CoreGraphics library functions is called with an excessive parameter (CGFLOAT_MAX anywhere?) that makes the graphics card go havoc. Here is the minimal example. Note that the simulator handles this case without problems, just the devices (tested on multiple phones and pods) hard-freeze.
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[_segmentedControl removeAllSegments];
_segmentedControl.arrowSize = 0.0;
[self performSelector:@selector(createMoreSegments:) withObject:nil afterDelay:2.0];
}
- (void)createMoreSegments:(id)sender
{
for ( int i = 0; i < 5; ++i )
{
[_segmentedControl insertSegmentWithTitle:[NSString stringWithFormat:@"Segment %u", i] atIndex:i animated:NO];
}
}
@end
Found same issue with the example.
Have you found a solution to the issue?
I have submitted a bug against iOS and Apple has requested me to add some StackShots, which I'm going to provide. No app should be able to do such a fatal operation, so I guess the creator of SDSegmentedControl is waiting for Apple to fix it.
So really this is unusable at this point?
Yes, for this particular combination (arrowSize = 0.0 and adding segments at runtime). I did not manage to get the StackShots yet for Apple, but i'm working on it.