IOS UITableView和NavigationBar的常用设置详解

TableView:
1.tableview常用基本设置
// 清除父类UIEdgeInsets self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0,0); //禁止滚动 self.tableView.scrollEnabled = NO; // tableview头部视图设置 self.tableView.tableHeaderView =一个UIView; //tableview尾部视图设置,这样用一个不占空间的UIView初始化可以清除尾部多余空格 self.tableView.tableFooterView = [[UIView alloc]initWithFrame:CGRectZero]; //表格背景色 self.tableView.backgroundColor = [UIColorgrayColor]; //取消垂直滚动条 self.tableView.showsVerticalScrollIndicator=NO; //设置表格背景图片 UIView *bgView= [[UIView alloc]initWithFrame:CGRectMake(0,20,SLApplicationW,SLApplicationH)]; UIImageView *bgImageView= [[UIImageView alloc]initWithFrame:CGRectMake(0,0,SLApplicationW,SLApplicationH)]; [bgImageView setImage:[UIImageimageNamed:@"tree"]]; [bgView addSubview:bgImageView]; self.tableView.backgroundView= bgView;
2.cell常用基本设置
//表格附件样式,指示箭头 cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator; //禁止点击变色 cell.selectionStyle=UITableViewCellSelectionStyleNone;
3.cell分割线左侧空白清除
//分割线清偏移
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cellsetSeparatorInset:UIEdgeInsetsZero];
}
//分割线清边界(没啥变化)
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cellsetLayoutMargins:UIEdgeInsetsZero];
}
//清除父边界
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){
[cellsetPreservesSuperviewLayoutMargins:NO];
}
NavigationBar导航栏:
1.常用基本设置
self.title =@"标题";
// 导航栏颜色
self.navigationBar.barTintColor=[UIColor grayColor];
// 导航栏文字颜色
self.navigationBar.tintColor=[UIColor whiteColor];
// 导航栏标题颜色
NSMutableDictionary*textAttrs= [NSMutableDictionary dictionary];
textAttrs[NSForegroundColorAttributeName] =[UIColor whiteColor];
self.navigationBarsetTitleTextAttributes:textAttrs];
//导航栏按钮1
UIBarButtonItem*button1= [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAddtarget:selfaction:@selector(function1)];
//导航栏按钮2
UIBarButtonItem*button2= [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemSearchtarget:selfaction:@selector(function2)];
//将按钮添加到导航栏右侧(可以添加多个)
self.navigationItem.rightBarButtonItems=@[button1, button2];
2.系统自带按钮
枚举定义及样式解释如下:
typedef NS_ENUM(NSInteger, UIBarButtonSystemItem) {
UIBarButtonSystemItemDone, //Done英文字符
UIBarButtonSystemItemCancel, //Cancel
UIBarButtonSystemItemEdit, //Edit
UIBarButtonSystemItemSave, //Save
UIBarButtonSystemItemAdd, //图标1(加号图标➕)
UIBarButtonSystemItemFlexibleSpace, //?空白
UIBarButtonSystemItemFixedSpace, //?空白
UIBarButtonSystemItemCompose, //图标2(写字板上一支笔写字的图标)
UIBarButtonSystemItemReply, //图标3
UIBarButtonSystemItemAction, //图标4
UIBarButtonSystemItemOrganize, //图标5
UIBarButtonSystemItemBookmarks, //<span style="font-family: Menlo;">图标6</span>
UIBarButtonSystemItemSearch, //<span style="font-family: Menlo;">图标7</span>
UIBarButtonSystemItemRefresh, //<span style="font-family: Menlo;">图标8</span>
UIBarButtonSystemItemStop, //图标9
UIBarButtonSystemItemCamera, //图标10
UIBarButtonSystemItemTrash, //图标11
UIBarButtonSystemItemPlay, //图标12
UIBarButtonSystemItemPause, //图标13
UIBarButtonSystemItemRewind, //图标14
UIBarButtonSystemItemFastForward, //图标15
UIBarButtonSystemItemUndo NS_ENUM_AVAILABLE_IOS(3_0), //Redo
UIBarButtonSystemItemRedo NS_ENUM_AVAILABLE_IOS(3_0), //Undo
UIBarButtonSystemItemPageCurl NS_ENUM_AVAILABLE_IOS(4_0), //?空白
};
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
# UITableView和NavigationBar的常用设置
# IOS
# UITableView和NavigationBar设置
# ios UITableView实现无数据加载占位图片
# iOS中UIScrollView嵌套UITableView的实践教程
# iOS中UITableView使用的常见问题总结
# iOS基于UITableView实现多层展开与收起
# iOS中UITableView Cell实现自定义单选功能
# iOS中的UITableView的重用机制与加载优化详解
# IOS UITableViewCell详解及按钮点击事件处理实例
# IOS中UITableView滚动到指定位置
# IOS UITableView颜色设置的实例详解
# 分割线
# 多个
# 一支
# 希望能
# 英文
# 谢谢大家
# 没啥
# 板上
# 不占
# 背景色
# 滚动条
# 系统自带
# SLApplicationH
# UIImageView
# cell
# tree
# accessoryType
# setImage
# UIImageimageNamed
# addSubview
相关文章:
网站专业制作公司有哪些,做一个公司网站要多少钱?
宝塔建站教程:一键部署配置流程与SEO优化实战指南
详解一款开源免费的.NET文档操作组件DocX(.NET组件介绍之一)
用v-html解决Vue.js渲染中html标签不被解析的问题
建站主机选购指南与交易推荐:核心配置解析
制作假网页,招聘网的薪资待遇,会有靠谱的吗?一面试又各种折扣?
制作充值网站的软件,做人力招聘为什么要自己交端口钱?
c++怎么编写动态链接库dll_c++ __declspec(dllexport)导出与调用【方法】
已有域名和空间如何快速搭建网站?
东莞专业网站制作公司有哪些,东莞招聘网站哪个好?
企业微网站怎么做,公司网站和公众号有什么区别?
购物网站制作费用多少,开办网上购物网站,需要办理哪些手续?
兔展官网 在线制作,怎样制作微信请帖?
网站制作与设计教程,如何制作一个企业网站,建设网站的基本步骤有哪些?
一键制作网站软件下载安装,一键自动采集网页文档制作步骤?
长春网站建设制作公司,长春的网络公司怎么样主要是能做网站的?
建站之星Pro快速搭建教程:模板选择与功能配置指南
建站之星多图banner生成与模板自定义指南
如何在云主机上快速搭建网站?
官网自助建站平台指南:在线制作、快速建站与模板选择全解析
深圳网站制作的公司有哪些,dido官方网站?
视频网站app制作软件,有什么好的视频聊天网站或者软件?
如何选择长沙网站建站模板?H5响应式与品牌定制哪个更优?
如何构建满足综合性能需求的优质建站方案?
如何通过虚拟主机快速完成网站搭建?
建站VPS配置与SEO优化指南:关键词排名提升策略
建站IDE高效指南:快速搭建+SEO优化+自适应模板全解析
,想在网上投简历,哪几个网站比较好?
制作网站公司那家好,网络公司是做什么的?
行程制作网站有哪些,第三方机票电子行程单怎么开?
测试制作网站有哪些,测试性取向的权威测试或者网站?
南京网站制作费用,南京远驱官方网站?
网站设计制作企业有哪些,抖音官网主页怎么设置?
如何用西部建站助手快速创建专业网站?
如何通过可视化优化提升建站效果?
头像制作网站在线观看,除了站酷,还有哪些比较好的设计网站?
平台云上自主建站:模板化设计与智能工具打造高效网站
广东专业制作网站有哪些,广东省能源集团有限公司官网?
如何使用Golang安装API文档生成工具_快速生成接口文档
网站制作多少钱一个,建一个论坛网站大约需要多少钱?
如何快速搭建自助建站会员专属系统?
平台云上自助建站如何快速打造专业网站?
如何在Golang中使用encoding/gob序列化对象_存储和传输数据
如何在阿里云虚拟主机上快速搭建个人网站?
如何挑选优质建站一级代理提升网站排名?
如何快速搭建高效可靠的建站解决方案?
外贸公司网站制作,外贸网站建设一般有哪些步骤?
香港服务器如何优化才能显著提升网站加载速度?
高防网站服务器:DDoS防御与BGP线路的AI智能防护方案
C++时间戳转换成日期时间的步骤和示例代码
*请认真填写需求信息,我们会在24小时内与您取得联系。