iOS 控件小句子,大技巧
2015-02-03 09:19
169 查看
有些时候一些效果只要一个句子就解决了,但是往往搜索半天,今天小编准备慢慢在学习路上遇到的都积累起来,随时更新
1.取消回弹
self.tableview.bounces =NO;
2.取消滚动条显示
self.tableView.showsVerticalScrollIndicator =NO;
3.去掉cell的分割线
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
或
_tableview.separatorStyle =UITableViewCellSeparatorStyleNone;
4.设置圆角
_big_view.layer.cornerRadius =8.0f;
[_big_view.layersetMasksToBounds:YES];
5.将图片设置为背景
self.view.backgroundColor
= [UIColorcolorWithPatternImage:[UIImageimageNamed:@"底板.jpg"]];
6. 设置tableview的背景图片
UIImageView * view = [[UIImageViewalloc]init];
view.backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"底板.jpg"]];
self.tableview.backgroundView = view;
7.将数组里的元素取出来,强转化成字典类型(当确定为字典类型时)
NSDictionary * dic = (NSDictionary *)[dataobjectAtIndex:[datacount] - indexPath.row];
8.去掉导航条(UINavigationbar)自带“Back”字样
UIBarButtonItem *returnButtonItem
= [[UIBarButtonItemalloc]init];
returnButtonItem.title =@"";(此处也可更改)
returnButtonItem.tintColor = [UIColor redColor];
self.navigationItem.backBarButtonItem = returnButtonItem;
9.改变导航条(UINavigationbar)自带返回箭头的颜色
self.navigationController.navigationBar.tintColor
= [UIColorblackColor];
10.UITextField 删除文本框效果(右侧有个叉按钮)
UITextField * field = [[UITextFieldalloc]init];
field.delegate =self;
field.frame =CGRectMake(20,20,280,30);
field.clearsOnBeginEditing =YES;
field.clearButtonMode =UITextFieldViewModeNever;//从不删除字符
field2.clearButtonMode =UITextFieldViewModeWhileEditing;//处于编辑状态才可删除字符
field3.clearButtonMode =UITextFieldViewModeUnlessEditing;//非编辑状态才可删除字符
field4.clearButtonMode =UITextFieldViewModeAlways;//总是可以删除字符
field.autocapitalizationType =
UITextAutocapitalizationTypeNone;
field.returnKeyType =
UIReturnKeyDone;
field.clearButtonMode =
UITextFieldViewModeWhileEditing; //编辑时会出现个修改X
field.contentVerticalAlignment =
UIControlContentVerticalAlignmentCenter;//垂直居中
field.borderStyle =
UITextBorderStyleRoundedRect;//圆角
11.取消滚动条
_home_collection.showsHorizontalScrollIndicator =NO;
12.改变导航条字体颜色
self.navigationItem.title =@"首页";
//改变导航条字体颜色
self.navigationController.navigationBar.titleTextAttributes
= [NSDictionarydictionaryWithObject:[UIColorwhiteColor]forKey:NSForegroundColorAttributeName];
13.当ScrollView 无法滑动
//设置回弹即可滑动
_images.alwaysBounceVertical =YES;
_images.userInteractionEnabled =YES;
1.取消回弹
self.tableview.bounces =NO;
2.取消滚动条显示
self.tableView.showsVerticalScrollIndicator =NO;
3.去掉cell的分割线
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
或
_tableview.separatorStyle =UITableViewCellSeparatorStyleNone;
4.设置圆角
_big_view.layer.cornerRadius =8.0f;
[_big_view.layersetMasksToBounds:YES];
5.将图片设置为背景
self.view.backgroundColor
= [UIColorcolorWithPatternImage:[UIImageimageNamed:@"底板.jpg"]];
6. 设置tableview的背景图片
UIImageView * view = [[UIImageViewalloc]init];
view.backgroundColor = [UIColorcolorWithPatternImage:[UIImageimageNamed:@"底板.jpg"]];
self.tableview.backgroundView = view;
7.将数组里的元素取出来,强转化成字典类型(当确定为字典类型时)
NSDictionary * dic = (NSDictionary *)[dataobjectAtIndex:[datacount] - indexPath.row];
8.去掉导航条(UINavigationbar)自带“Back”字样
UIBarButtonItem *returnButtonItem
= [[UIBarButtonItemalloc]init];
returnButtonItem.title =@"";(此处也可更改)
returnButtonItem.tintColor = [UIColor redColor];
self.navigationItem.backBarButtonItem = returnButtonItem;
9.改变导航条(UINavigationbar)自带返回箭头的颜色
self.navigationController.navigationBar.tintColor
= [UIColorblackColor];
10.UITextField 删除文本框效果(右侧有个叉按钮)
UITextField * field = [[UITextFieldalloc]init];
field.delegate =self;
field.frame =CGRectMake(20,20,280,30);
field.clearsOnBeginEditing =YES;
field.clearButtonMode =UITextFieldViewModeNever;//从不删除字符
field2.clearButtonMode =UITextFieldViewModeWhileEditing;//处于编辑状态才可删除字符
field3.clearButtonMode =UITextFieldViewModeUnlessEditing;//非编辑状态才可删除字符
field4.clearButtonMode =UITextFieldViewModeAlways;//总是可以删除字符
field.autocapitalizationType =
UITextAutocapitalizationTypeNone;
field.returnKeyType =
UIReturnKeyDone;
field.clearButtonMode =
UITextFieldViewModeWhileEditing; //编辑时会出现个修改X
field.contentVerticalAlignment =
UIControlContentVerticalAlignmentCenter;//垂直居中
field.borderStyle =
UITextBorderStyleRoundedRect;//圆角
11.取消滚动条
_home_collection.showsHorizontalScrollIndicator =NO;
12.改变导航条字体颜色
self.navigationItem.title =@"首页";
//改变导航条字体颜色
self.navigationController.navigationBar.titleTextAttributes
= [NSDictionarydictionaryWithObject:[UIColorwhiteColor]forKey:NSForegroundColorAttributeName];
13.当ScrollView 无法滑动
//设置回弹即可滑动
_images.alwaysBounceVertical =YES;
_images.userInteractionEnabled =YES;
相关文章推荐
- iOS UI控件没有显示时的调试技巧
- [iOS 技巧 -11] 监听控件的一些情况 所采取的方法
- [iOS开发技巧之]iPhone走马灯控件实现
- [iOS]技巧集锦:UITableView自定义Cell中的控件无法完全对齐Cell的左边界和右边界
- 【iOS 技巧 - 9 】某个控件没有出现的一般排错方法
- iOS开发技巧 - 使用和定制开关控件(UISwitch)
- iOS开发技巧 - 使用和定制开关控件(UISwitch)
- iOS控件使用技巧1
- IOS控件之UITableView使用技巧
- 利用.NET的File控件上传文件技巧
- 关于.net 控件的html 属性的几点技巧
- 在打开的Web表单模态窗口中,避免点击服务端控件时弹出新窗口的技巧
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- ASP.NET 2.0中Gridview控件高级技巧
- 技巧和诀窍:UpdateProgress控件和AJAX活动图像动画
- ASP.NET 2.0中Gridview控件高级技巧
- 在MFC中应用CTreeCtrl控件的技巧
- ASP.NET 2.0中Gridview控件高级技巧
- VC控件使用技巧