不积跬步,无以至千里;不积小流,无以成江海

Our practice

不积跬步,无以至千里;不积小流,无以成江海

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

好像仅适用于:tableview的style有plain和group之分,如果用plain,写上下面的代码,则可以出现下面效果。

 

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    if(section == 0){

        UIView *headerView =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

       

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];

label.backgroundColor = [UIColor colorWithRed:137/255.0 green:154/255.0 blue:168/255.0 alpha:0.8];

label.font = [UIFont boldSystemFontOfSize:14];

//label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.8];

label.textAlignment = UITextAlignmentLeft;

label.textColor = [UIColor whiteColor];

label.text = [NSString stringWithFormat:@"当前地区:%@",appDelegate.hotTrend.region.name]; 

[headerView addSubview:label];

[label release];

        return headerView;

    }else{

        return nil;

    }

    

}

posted on 2011-03-03 00:43  英怀  阅读(5327)  评论(0编辑  收藏  举报