iOS开发经验总结:自定义UITableView
2012-12-05 10:19
489 查看
一、自定义UITableView hearder
http://www.cocoachina.com/bbs/read.php?tid-12269.html
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *v_headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 23)];//创建一个视图(v_headerView) UIImageView *v_headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 23)];//创建一个UIimageView(v_headerImageView) v_headerImageView.image = [UIImage imageNamed:@"ip_top bar.png"];//给v_headerImageView设置图片 [v_headerView addSubview:v_headerImageView];//将v_headerImageView添加到创建的视图(v_headerView)中 [v_headerImageView release];//释放v_headerImageView所占用的资源 UILabel *v_headerLab = [[UILabel alloc] initWithFrame:CGRectMake(10, 1, 100, 19)];//创建一个UILable(v_headerLab)用来显示标题 v_headerLab.backgroundColor = [UIColor clearColor];//设置v_headerLab的背景颜色 v_headerLab.textColor = [UIColor grayColor];//设置v_headerLab的字体颜色 v_headerLab.font = [UIFont fontWithName:@"Arial" size:13];//设置v_headerLab的字体样式和大小 v_headerLab.shadowColor = [UIColor whiteColor];//设置v_headerLab的字体的投影 [v_headerLab setShadowOffset:CGSizeMake(0, 1)];//设置v_headerLab的字体投影的位置 //设置每组的的标题 if (section == 0) { v_headerLab.text = @"拍品导航"; } if (section == 1) { v_headerLab.text = @"专场特卖"; } [v_headerView addSubview:v_headerLab];//将标题v_headerLab添加到创建的视图(v_headerView)中 [v_headerLab release];//释放v_headerLab所占用的资源 return v_headerView;//将视图(v_headerView)返回 }
http://www.cocoachina.com/bbs/read.php?tid-12269.html
}
相关文章推荐
- iOS开发和学习中积累的一些经验总结提炼整理文章001——自定义Cell
- iOS开发经验总结(二)
- 我的iOS开发经验总结
- [iPhone 开发]美女开发者总结的25条iOS开发经验
- 个人总结学 iOS 开发的15条经验
- Android IOS WebRTC 音视频开发总结(六) iOS开发之含泪经验
- 对于 iOS 开发基于经验的一些总结与规划 (转载侵删)
- iOS开发15:自定义UITableViewCell
- iOS开发经验总结(上)
- iOS开发之自定义UITableView
- 12条ios软件开发经验总结
- iOS开发经验总结
- 【IOS】分享下近一年IOS开发的经验总结
- iOS 开发 中级:UIToolbar,UINavigationBar,UITabBar,UIBarButtonItem,UITabBarItem自定义方法总结