3

我有一个视图控制器。当我传递一个额外的对象时,我在下面的函数中收到此错误@No visible interface。你能帮帮我吗。下面是代码。我在哪里传递一个照片类型的对象。

  ItemImageView *itemImage = [[ItemImageView alloc]initWithFrame:CGRectMake(currentPhotoPositionX,0,pageButtonWidth,pageButtonHeight) andPhoto:photo];

@ItemImageview


 - (id)initWithFrame:(CGRect)frame :andPhoto:(Photo *)photo
   {
self = [super initWithFrame:frame];
if (self) {
    // Initialization code

    //Create Activity Indicator
     activityIndicator= [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(225, 115, 30, 30)];
    [activityIndicator setBackgroundColor:[UIColor clearColor]];
    [activityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhite];
    [self addSubview:activityIndicator];

    //Create Label Comments

    lblComments = [[UILabel alloc] initWithFrame:CGRectMake(30.0f, 100.0f, 60.0f, 43.0f)];
    [lblComments setText:@"Comments"];
    [lblComments setBackgroundColor:[UIColor clearColor]];
    [self addSubview:lblComments];

    //Create Label Likes

    lblLikes = [[UILabel alloc] initWithFrame:CGRectMake(100.0f, 100.0f, 60.0f, 43.0f)];
    [lblLikes setText:@"Likes"];
    [lblLikes setBackgroundColor:[UIColor clearColor]];
    [self addSubview:lblLikes];


    //Create Item Button

    btnItem = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [btnItem addTarget:self
                action:@selector(:)
      forControlEvents:UIControlEventTouchUpInside];
    [btnItem setBackgroundImage:[UIImage imageNamed:@"1.png"] forState:UIControlStateNormal];
    btnItem.frame = CGRectMake(0.0f, 0.0f, 144.0f, 143.0f);
    [self addSubview:btnItem];


}

return self;

}

4

1 回答 1

6

将其更改为:

- (id)initWithFrame:(CGRect)frame andPhoto:(Photo *)photo

还要记住将其添加到您的 .h 文件中。

于 2012-12-18T11:59:47.803 回答