Pav*_*vel 1 iphone objective-c ios
我的应用程序在4.3.1模拟器和5.0模拟器中显示了这一点.


这是代码:
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return @"";
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return [[Singleton sharedInstance] getTitleSectionView:segmentedControl.selectedSegmentIndex inDay:section];
}
-(UIView *)getTitleSectionView:(int)week inDay:(int)day;
{
UILabel *lab=[[[UILabel alloc]init]autorelease];
lab.frame=CGRectMake(5, 0,320,20);
lab.text=[[Singleton sharedInstance] getTitleSection:week inDay:day];
lab.backgroundColor=[UIColor clearColor];
lab.textColor=[UIColor whiteColor];
lab.font = [UIFont fontWithName:@"Arial" size:14];
UIImageView * imv = [[[UIImageView alloc]initWithFrame:CGRectMake(0,0, 320, 20)]autorelease];
imv.image=[UIImage imageNamed:@"section-header-bg.png"];
UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)]autorelease];
[view addSubview:imv];
[view addSubview:lab];
Week *currentWeek = nil;
if(week)
currentWeek = nechetNedel;
else
currentWeek = chetNedel;
NSMutableArray *dayArray = [currentWeek.days objectAtIndex:day];
if([dayArray count] >0)
return view;
return nil;
}
Run Code Online (Sandbox Code Playgroud)
可能是什么问题,为什么5.0节模拟器中出现了多行?我试图删除该方法,- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section但它没有帮助.我删除了这个方法(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section,线条消失了
您应该为空部分返回nil
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;
Run Code Online (Sandbox Code Playgroud)
和
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
Run Code Online (Sandbox Code Playgroud)
应该返回0
然后它会工作.它是iOS 5.x问题(或功能)
| 归档时间: |
|
| 查看次数: |
5473 次 |
| 最近记录: |