UITableView和NavigationBar的常用设置
来源:互联网 发布:淘宝注册网址 编辑:程序博客网 时间:2024/06/17 01:34
TableView:
1.tableview常用基本设置
// 清除父类UIEdgeInsetsself.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]; //导航栏按钮1UIBarButtonItem*button1= [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAddtarget:selfaction:@selector(function1)];//导航栏按钮2UIBarButtonItem*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), //?空白};
1 0
- UITableView和NavigationBar的常用设置
- UITableView(基本设置和常用的协议方法)
- 关于NavigationBar背景图片和颜色的设置
- navigationbar颜色和字体颜色的设置
- 关于NavigationBar背景图片和颜色的设置
- ios-设置navigationBar和tabBar的样式
- UINavigationController的navigationBar的常用设置(按钮,标题,颜色)
- 设置NavigationBar的背景
- 设置navigationBar的透明度
- 设置透明的NavigationBar
- UITableView的一些常用细节设置
- UITableView常用设置
- navigationBar 和 navigationItem 设置 titleView 时的不同
- 设置navigationbar的标题样式和背景颜色
- swift 设置navigationBar的背景颜色和字体颜色
- iOS开发-设置NavigationBar的颜色和字体属性
- Swift 设置navigationBar的title字体大小和字体颜色
- navigationController中navigationBar 的设置
- 【IOS沉思录】IOS开发键盘显示、隐藏事件实现输入框调整防止键盘遮挡
- 欧拉项目第8题 Largest product in a series
- IntelliJ IDEA中怎么查看文件中所有方法(类似eclipse里面的outline)
- 51822代码篇2
- jsonp解决跨域问题
- UITableView和NavigationBar的常用设置
- IOS底部导航设置与页面多级跳转
- 工厂方法
- UIKit-boundingRectWithSize计算多行UILabel的文字高度
- UIKit-UIView常用设置
- 文章标题
- UIKit-UIView二维图形Affine几何基本变换
- UIKit-UIAlertView,UIActionSheet,UIAlertController使用方法(完整版)
- UIKit-UIDatePicker和UIPickerView