Iphone 将数据动态绑定到icarousel
我正在使用icarousel在我的项目中显示coverflow。。我使用uiview作为包含标签和图像视图的旋转木马项目。旋转木马的数据来自对web服务的调用,我将该数据绑定到uiview的标签和图像视图,我将其用作旋转木马项目。现在的问题是,由于来自web服务的数据很大,所以加载数据并将其绑定到icarousel需要很多时间,所以它几乎冻结了我的应用程序。。 现在,我想要的是异步下载数据并将其绑定到icarousel,以便立即显示数据,用户无需等待服务器上的所有数据被下载Iphone 将数据动态绑定到icarousel,iphone,ios,xcode,coverflow,icarousel,Iphone,Ios,Xcode,Coverflow,Icarousel,我正在使用icarousel在我的项目中显示coverflow。。我使用uiview作为包含标签和图像视图的旋转木马项目。旋转木马的数据来自对web服务的调用,我将该数据绑定到uiview的标签和图像视图,我将其用作旋转木马项目。现在的问题是,由于来自web服务的数据很大,所以加载数据并将其绑定到icarousel需要很多时间,所以它几乎冻结了我的应用程序。。 现在,我想要的是异步下载数据并将其绑定到icarousel,以便立即显示数据,用户无需等待服务器上的所有数据被下载 任何帮助都将不胜感激
任何帮助都将不胜感激。。谢谢我建议使用AFNetworking之类的工具来执行异步数据检索。返回响应后,迭代返回的所有数据对象并调用
[carousel insertItemAtIndex:index animated:YES]代码>如下所示:
@interface ViewController ()
@property (nonatomic, retain) NSMutableArray *items;
@end
// This is a sample function, actual implementation will look different for you
- (void)callBackFromAsyncWebService:(NSArray*)data
{
for (id dataObj in data) {
[self insertItem:dataObj];
}
}
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return [items count];
}
- (IBAction)insertItem:(id)item
{
NSInteger index = MAX(0, carousel.currentItemIndex);
[items insertObject:item atIndex:index];
[carousel insertItemAtIndex:index animated:YES];
}