iCarousel 显示偏移为 1/2 高度和 1/2 宽度
Posted
技术标签:
【中文标题】iCarousel 显示偏移为 1/2 高度和 1/2 宽度【英文标题】:iCarousel shows with an offset of 1/2 heigh and 1/2 width 【发布时间】:2014-07-25 19:27:19 【问题描述】:视图有 1/2 view.width 和 1/2 view.heigth 的偏移量,我不知道为什么。 (我没有足够的声誉,无法上传图片)
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
UILabel *label;
UILabel *label2;
UILabel *label3;
UILabel *label4;
UILabel *label5;
UIViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"mockUp"];
view = [viewController.view viewWithTag:999];
label=(UILabel*)[view viewWithTag:109];
label2=(UILabel*)[view viewWithTag:110];
label3=(UILabel*)[view viewWithTag:111];
label4=(UILabel*)[view viewWithTag:112];
label5=(UILabel*)[view viewWithTag:113];
CGRect Frame = CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, view.frame.size.height);
view.frame = Frame;
label.text = [[listOfCompaniesCalledPortfolio objectAtIndex:index]nameOfTheCompanie];
label2.text = [[listOfCompaniesCalledPortfolio objectAtIndex:index]sector];
label3.text = [[listOfCompaniesCalledPortfolio objectAtIndex:index]companyLocation];
label4.text = [[listOfCompaniesCalledPortfolio objectAtIndex:index]busDescription];
label5.text = [[listOfCompaniesCalledPortfolio objectAtIndex:index]founders];
return view;
【问题讨论】:
【参考方案1】:希望您实现了这些 iCarousel 代表:
- (CGFloat)carouselItemWidth:(iCarousel *)carousel
return 200.0; //your expected width
- (CGFloat)carouselItemHeight:(iCarousel *)carousel
return 200.0; //your expected height
【讨论】:
轮播的大小是我实例化的视图之一(viewWithTag:999),所以没关系。问题是它看起来所有的视图都有一个偏移量.. 您可以上传或链接快照吗?以上是关于iCarousel 显示偏移为 1/2 高度和 1/2 宽度的主要内容,如果未能解决你的问题,请参考以下文章