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

reusingView #463

Open robipresotto opened 10 years ago

robipresotto commented 10 years ago

Hi, nick : )

I'm losing the contents of the screen when I have two items of the same type side by side on the carousel… Why? Look the screen shots...

My code, screen shot 2014-01-16 at 17 09 22

iPhone Simulator (two itens the same type, side by side... untitled

Great job man : )) Best Regards,

nicklockwood commented 10 years ago

A UIView can only have one superview. If you try to add a UIView that is already inside an iCarousel item to another item it will automatically be removed from the first one, leaving it blank (this is a feature of UIKit, not iCarousel).

If you want to have the same item on screen twice, you will have to create two separate copies of the view, you can't reuse the same view multiple times.

robipresotto commented 10 years ago

Can you explain me better?

'm getting this error: UICatalog: Invalid asset name supplied:, or invalid scale factor: 2.000000

nicklockwood commented 10 years ago

UICatalog isn't a property of iCarousel, so I don't think that has anything to do with it.

My point about views is that if you have two copies of self.tableViewMovie in the carousel, only one of them will be displayed because tableViewMovie is a view and you can only have one copy of the same view on screen at once.

You need to create a unique instance of tableViewMovie for each carousel item, you can't store one copy in a property and reuse it.

robipresotto commented 10 years ago

Thank you nick,

I forgot to allocate memory for a new tableview, now working better… sometimes the screen goes blank…

new code,

}

and the tableview reloadData on the currentItemIndexDidChange… it's right?