2010-11-20 59 views
0

我宣布一个IB出口为的UIImageView并试图验证码:如果UIImageView的说法是不工作

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; 
    return [sectionInfo numberOfObjects]; 
    if (section > 1){ 
     mySpeech.hidden = YES; 
    } 
} 

mySpeech是UIImageView的...

但它不工作!有任何想法吗?

回答

1

您需要将return语句放在最后,因为它没有执行任何操作。

+0

嗯,这没有工作: - (NSInteger的)的tableView:(UITableView的*)的tableView numberOfRowsInSection:(NSInteger的)部分{ \t ID sectionInfo = [[self.fetchedResultsController部分] objectAtIndex:节]。 (section> 1){ \t \t mySpeech.hidden = YES; \t} \t \t return [sectionInfo numberOfObjects]; } – benhowdle89 2010-11-20 19:17:46

+0

你在滥用这种方法。它不是*旨在调整您的意见或内容,它*只是*应该记住行数。设置隐藏的内容应该放在tableView:cellForRowAtIndexPath:中。另外,别忘了在其他情况下设置hidden = NO。但是,这种方法并不适合这一点。 – Eiko 2010-11-20 19:29:46