2011-05-06 108 views
0

任何人都可以告诉我为什么我得到这个错误?如何解决uiscrollview错误

[myClassName 的tableView:numberOfRowsInSection:]:无法识别 选择发送到实例 0x8ad5a90'

我知道这是什么意思,但在myClassName类我没有使用任何的UITableView! !我在这个类中没有tableView的scrollview,所以我找不到为什么我得到这个错误。

编辑:

- (void)viewDidLoad 
{ 
imageIndex = 0; 
int count =0; 
int totalScrollRow = 0; 

myScroll.contentSize = CGSizeMake(0, 397); 
NSLog(@"%f",myScroll.contentSize.height); 

volPhotoApp = (MyAppDelegate *) [[UIApplication sharedApplication] delegate]; 

volPhotoApp.photoGalleryIndex = 0 ; 

eventRow = [volPhotoApp.volPhotoArray objectAtIndex:selectedIndex]; 
numberOfImages = [eventRow.photoArray count]; 

if (numberOfImages == 0) 
{ 
    UILabel *zeroLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 200)]; 
    zeroLabel.text = @"No Images.."; 

    [myScroll addSubview:zeroLabel]; 
    return; 
} 

header.enabled =NO; 
[header setTitle:eventRow.title forState:UIControlStateNormal]; 

CGRect contentRect = myScroll.bounds; 

CGFloat boundX = contentRect.origin.x; 

CGFloat boundY = contentRect.origin.y; 

CGRect frame1 ; 

for (int i=0, X=5 ; i < numberOfImages; i++, X+=80) 
{  
    if (count == 4) 
    { 
     boundX = 5; 

     boundY += 70; 

     X = 0; 

     count = 0; 

    } 

    frame1 = CGRectMake(boundX+X ,boundY+5, 70, 65); 
    AsyncImageView *av1 = [[AsyncImageView alloc] initWithFrame:frame1]; 
    [av1 loadImageFromURL:[NSURL URLWithString:[eventRow.photoArray objectAtIndex:volPhotoApp.photoGalleryIndex]]]; 
    av1.backgroundColor = [UIColor clearColor]; 
    volPhotoApp.photoGalleryIndex++; 

    UIButton *b1 = [[UIButton alloc] initWithFrame:frame1]; 
    b1.backgroundColor = [UIColor clearColor]; 
    [b1 setTitle:@"" forState:UIControlStateNormal]; 
    b1.tag = volPhotoApp.photoGalleryIndex; 
    [b1 addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchDown]; 
    b1.enabled = YES; 
    count++; 

    [myScroll addSubview:av1]; 

    [myScroll addSubview:b1]; 
    totalScrollRow++; 

    if (volPhotoApp.photoGalleryIndex == numberOfImages) 
    { 
     volPhotoApp.photoGalleryIndex = 0 ; 
     break; 
    } 

} 
NSLog(@"%f",boundY); 
NSLog(@"%d",totalScrollRow); 

NSLog(@"%f",myScroll.contentSize.height); 

if (boundY > myScroll.contentSize.height || totalScrollRow > 20) 
{ 
    myScroll.contentSize = CGSizeMake(0, boundY+75); 
} 

[super viewDidLoad]; 
    } 

谢谢..

+0

@Maulik:您的代码请参阅。 – visakh7 2011-05-06 06:13:19

+0

myClassName是您的程序中某些UITableView的dataSource委托。也许你忘了在Interface Builder中删除绑定? – 5hrp 2011-05-06 06:18:12

+0

我在第一次尝试时所做的操作我已经使用了UITableView,然后删除了那个xib文件并创建了新的并使用了scrollview ....我也从硬盘上删除了这个旧的xib。 – Maulik 2011-05-06 06:20:48

回答

1

,你可能是继承的UITableViewController或充当委托?没有代码,它只是猜测。