ios – iCarousel未显示,方法未被处理

ios – iCarousel未显示,方法未被处理,第1张

概述我试图通过两侧淡入淡出实现左侧iCarousel对象的权利. 所以我将GtiHub项目导入我的应用程序,为i​​Carousel分配了一个UIView …将它链接到我的MainViewController上的IBOutLet并传递了Delegate以及DataSource,就像UITableViewController一样. 虽然它不会出现,我不确定可能导致这个问题的原因. 我的iCarousel 我试图通过两侧淡入淡出实现左侧iCarousel对象的权利.

所以我将GtiHub项目导入我的应用程序,为i​​Carousel分配了一个UIVIEw …将它链接到我的MainVIEwController上的IBOutLet并传递了Delegate以及DataSource,就像UItableVIEwController一样.

虽然它不会出现,我不确定可能导致这个问题的原因.

我的iCarousel DataSource是一个NSMutableArray *项目;设计如下:

for (int i = 0; i < 100; i++){    [_items addobject:@(i)];}

我正在VIEwDIDLoad中初始化iCarousel,如下所示

- (voID)vIEwDIDLoad{  [super vIEwDIDLoad];  //Initialize Carousel  _carousel = [[iCarousel alloc] init];  _carousel.delegate = self;  _carousel.dataSource = self;  //Carousel Testing Data  for (int i = 0; i < 100; i++)  {     [_items addobject:@(i)];  }  //configure carousel  _carousel.type = iCarouselTypeRotary;}

我的旋转木马代表方法如下:

#pragma mark -#pragma mark iCarousel methods- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel{   //return the total number of items in the carousel   return [_items count];}- (UIVIEw *)carousel:(iCarousel *)carousel vIEwForItemAtIndex:(NSUInteger)index reusingVIEw:(UIVIEw *)vIEw{   UILabel *label = nil;   //create new vIEw if no vIEw is available for recycling   if (vIEw == nil)   {      vIEw = [[UIImageVIEw alloc] initWithFrame:CGRectMake(0,200.0f,200.0f)];      ((UIImageVIEw *)vIEw).image = [UIImage imagenamed:@"page.png"];      vIEw.contentMode = UIVIEwContentModeCenter;      label = [[UILabel alloc] initWithFrame:vIEw.bounds];      label.backgroundcolor = [UIcolor clearcolor];      label.Font = [label.Font FontWithSize:50];      label.tag = 1;      [vIEw addSubvIEw:label];   }  else   {      //get a reference to the label in the recycled vIEw      label = (UILabel *)[vIEw vIEwWithTag:1];   }  label.text = [_items[index] stringValue];  return vIEw;} - (CGfloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGfloat)value {    switch (option)    {       case iCarouselOptionFadeMin:           return -0.2;       case iCarouselOptionFadeMax:           return 0.2;       case iCarouselOptionFadeRange:           return 2.0;       default:           return value;     }  }

故事板中的所有内容似乎都是连接起来的,数据应该呈现出来,出了什么问题以及如何解决这个问题?

解决方法 由于在加载视图后设置了DataSource数组(_items):

>确保故事板中的轮播视图确实具有控制器的IBOutlet,但不是链接到文件所有者(控制器或视图)的“委托”和“数据源”.>仅将_carousel.delegate和_carousel.dataSource设置为“self”初始化并更新dataSource数组(在本例中为_items).

总结

以上是内存溢出为你收集整理的ios – iCarousel未显示,方法未被处理全部内容,希望文章能够帮你解决ios – iCarousel未显示,方法未被处理所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1057923.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存