我想在ios應用程序的sectionHeaderView中獲得背景圖像。有些東西不對,我需要釋放它,因爲我有兩個值。sectionHeader在iOS中的背景圖像
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIImage *myImage = [UIImage imageNamed:@"bar-two.jpg"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
imageView.frame = CGRectMake(10,10,1,30);
return imageView;
APLSectionHeaderView *sectionHeaderView = [self.tblView dequeueReusableHeaderFooterViewWithIdentifier:SectionHeaderViewIdentifier];
APLSectionInfo *sectionInfo = (self.sectionInfoArray)[section];
sectionInfo.headerView = sectionHeaderView;
sectionHeaderView.titleLabel.text = sectionInfo.climb.name;
sectionHeaderView.section = section;
sectionHeaderView.delegate = self;
return sectionHeaderView;
}
有什麼不對?爲什麼兩個人都回來了,你是否忘記了「如果......其他......」? – simalone
由於'return imageView'行 – Raptor
imageview.frame = CGRectMake(10,10,1,30);因此一半的代碼無法訪問。 您已將imageview寬度保持爲1像素寬度是否正確? – Leena