rs / SDSegmentedControl

A drop-in remplacement for UISegmentedControl that mimic iOS 6 AppStore tab controls
MIT License
1.2k stars 180 forks source link

SDSegmentedControl hard-freezes iOS devices #24

Open mickeyl opened 11 years ago

mickeyl commented 11 years ago

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
mave99a commented 11 years ago

Found same issue with the example.

inPhilly commented 11 years ago

Have you found a solution to the issue?

mickeyl commented 11 years ago

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.

inPhilly commented 11 years ago

So really this is unusable at this point?

mickeyl commented 11 years ago

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.