iCarousel显示偏移量为1/2高度和1/2宽度

时间:2014-07-25 19:27:19

标签: ios uiview uiviewcontroller indexing icarousel

视图的偏移量为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 个答案:

答案 0 :(得分:0)

希望您实施这些iCarousel代表:

- (CGFloat)carouselItemWidth:(iCarousel *)carousel
   {
     return 200.0; //your expected width
   }

- (CGFloat)carouselItemHeight:(iCarousel *)carousel
   {
     return 200.0; //your expected height
   }