SDSegmentedControl icon indicating copy to clipboard operation
SDSegmentedControl copied to clipboard

Control not displayed properly after rotating in another view controller

Open nickygerritsen opened this issue 12 years ago • 4 comments

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:

  • Switch to second tab
  • Rotate device to landscape
  • Switch back to first tab

But the following does not work as expected:

  • Rotate the device to landscape and back to portrait
  • Switch to second tab
  • Rotate device to landscape
  • Switch back to first tab

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...

nickygerritsen avatar Aug 13 '13 11:08 nickygerritsen

+1

bm-i avatar Aug 22 '13 08:08 bm-i

+2 22 aug 2013 kl. 10:46 skrev bm-i [email protected]:

+1

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

Janne-M avatar Aug 22 '13 21:08 Janne-M

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

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

maxma86 avatar Oct 17 '13 02:10 maxma86

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

maxma86 avatar Oct 17 '13 02:10 maxma86