nicklockwood / iCarousel

A simple, highly customisable, data-driven 3D carousel for iOS and Mac OS
http://www.charcoaldesign.co.uk/source/cocoa#icarousel
Other
12k stars 2.58k forks source link

iCarousel dissapears in IOS 11 #835

Open JeeGee1983 opened 6 years ago

JeeGee1983 commented 6 years ago

With an iCarousel object in my ViewController, the carousel dissappears when presenting an UIAlertController (UIAlertControllerStyleActionSheet) or UIPopoverController. The function reloadData has to be called to get it back.

Any idea how this can be solved?

JeeGee1983 commented 6 years ago

Nobody?

Zbeyer commented 6 years ago

@JeeGee1983 I'm also having this issue in one of the older apps I support. Have you found a workaround? I only see this issue on iOS 11.

JeeGee1983 commented 6 years ago

@Zbeyer, unfortunately not. I’m reloading the carousel every time after dismissing the UIAlertController or PopoverController. Not I nice solution because when doing this, the items flash.

I have send an email to Charcoal Design to ask if they have any idea where to look for a solution.

Zbeyer commented 6 years ago

Yeah, that's not something that will work for me. :|

JeeGee1983 commented 6 years ago

@Zbeyer, found a solution already?

joywt commented 6 years ago

I'm also having this issue. With an iCarousel object in tableViewCell, the carousel dissappears when cell recycled

Zbeyer commented 6 years ago

@JeeGee1983 I ended up doing something similar. Had to re-write instances where popovers are generated and in the constructors and deconstructors raise events using NSNotificationCenter that trigger iCarousel to redraw.

Like @JeeGee1983, now the items flash whenever a popover is opened or dismissed, however the users are now able to access their content. To my knowledge this is the only working solution anyone has come up with, correct?

- (void)viewWillAppear:(BOOL)animated {
...
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadCarousel) name:kPopoverReDrawNotification object:nil];
}
- (void)reloadCarousel {
    //iOS 11 introduced break in iCarousel when a popover appears or disappears. The only known workaround is the force iCarousel to redraw as part of the popover
    [self.carousel reloadData];
}

Where possible, I used existing delegate methods to post the notification:

#pragma mark - PopoverDelegate
- (void) popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
    [[NSNotificationCenter defaultCenter] postNotificationName:kPopoverReDrawNotification object:nil];
}
doudouperrin commented 6 years ago

Hi, I m planning to integrate this iCarousel. Does this issue remain? Any fixes about the items flash behaviour?

zwo commented 5 years ago

My solution is creating a new window, put this window above current window, and set UIAlertController to the root view controller of this window. After some debugging, I found the reason why the carousel disappear is that after presenting a view controller, system implicitly clears all the animations attached to the views below. Carousel just layouts its sub views by animations! If anyone still get stuck by this issue, can ask me for some sample codes.