rs / SDSegmentedControl

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

Control not displayed properly after rotating in another view controller #49

Open nickygerritsen opened 10 years ago

nickygerritsen commented 10 years ago

I'm not sure if it is linked to issue #44, but I have found another bug: when rotating the device when the segmented control is not visible (i.e. in another view controller) and then returning to the view controller again, the paths aren't drawn correctly.

To reproduce:

Create an empty iOS application, add SDSegmentedControl and use this as the application: didFinishLaunchingWithOptions:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    UIViewController *firstVC = [[UIViewController alloc] init];
    firstVC.title = @"Segment";
    UIViewController *secondVC = [[UIViewController alloc] init];
    secondVC.title = @"Dummy";

    SDSegmentedControl *segmentController = [[SDSegmentedControl alloc] initWithItems:@[@"1", @"2"]];
    segmentController.frame = CGRectMake(0, 0, self.window.frame.size.width, segmentController.frame.size.height);

    [firstVC.view addSubview:segmentController];

    UITabBarController *rootController = [[UITabBarController alloc] init];
    [rootController addChildViewController:firstVC];
    [rootController addChildViewController:secondVC];
    self.window.rootViewController = rootController;
    [self.window makeKeyAndVisible];
    return YES;
}

Now start the application. The following scenario works as expected:

But the following does not work as expected:

In this second case, the paths that are drawn only occupy the 320 points of the portrait mode.

I already found that it goes wrong in the function that draws the paths and only when the duration > 0. But then I got stuck trying to fix it...

bm-i commented 10 years ago

+1

Janne-M commented 10 years ago

+2 22 aug 2013 kl. 10:46 skrev bm-i notifications@github.com:

+1

— Reply to this email directly or view it on GitHub.

maxma86 commented 10 years ago

8c16ad40-e8e8-4c84-8cbd-b90665097eb1

Yes, I met this problem. Any idea? I don't know where draw the paths

maxma86 commented 10 years ago

Can any one update it? Just remove duration > 0?