【发布时间】:2012-02-24 02:20:41
【问题描述】:
我的应用在 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;
}
可能是什么问题,为什么 5.0 模拟器中会出现几行部分?我试图删除方法- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section,但没有帮助。我删除了这个方法(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section,线条消失了
【问题讨论】:
-
告诉我们
numberOfSectionsInTableView:。 -
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 7; }
-
现在计算 iOS 5 sim 中褐色和灰色的标题。你明白了吗?
-
Matthias Bauch 我不太明白
-
rokjarc 我无法更正节数,例如我在第 4 节中有数据,但返回 1 个计数,表中将是第一节
标签: iphone objective-c ios