programmatically set uiimage's visibility
I've dragged a UIImage in interface builder onto the view and selected my PNG from the dropdown, that works great but if I want to change the visibility of the uiimage according to the number of rows in this table code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
return [sectionInfo numberOfObjects];
}
Would I have to declare the开发者_如何学Python uiimage as an outlet and how would I code the visibility in the above code if the number of rows in the table was more that 1 (ie. there were rows present)
If you want to do it simply based on the number of rows in the section you should just be able to do something like this:
-(NSInteger)tableView: (UITableView *)tableView numberOfRowsInSection:(NSInteger) section {
if(section == "whatever number you want to base the visibility off of")
imageView.hidden = YES;
}
Where the imageView is the UIImageView that is on the page.
Try using
imageView.hidden = YES;
精彩评论