【ios开发学习】常见问题积累
来源:互联网 发布:网络舆情队伍建设 编辑:程序博客网 时间:2024/06/06 21:39
1.UITableView的常见问题:
//设置顶部不留白
self.automaticallyAdjustsScrollViewInsets = NO;
//去除tableview顶部和底部的section
tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f,tableView.bounds.size.width, 0.001f)];
tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f,tableView.bounds.size.width, 0.01f)];
//去除tableview内部的section
tableView.sectionHeaderHeight = 0.0f;
tableView.sectionFooterHeight = 0.0f;
//去除上拉cell之间的灰色分割线
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
2.UITextField的常见问题
//输入文字不在边框处开始显示,输入字符距离左边界有一定距离
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 20)];
inputCodeText.leftView = paddingView;
inputCodeText.leftViewMode = UITextFieldViewModeAlways;
//默认显示输入法数字键盘
numText.keyboardType=UIKeyboardTypeNumberPad;
//修改输入法return按钮的功能
numText.returnKeyType =UIReturnKeyDone;
//失去焦点,隐藏输入法
[numTextresignFirstResponder];
3.UIButton的常见问题
//s设置UIbutton或其它view的边界的宽度和边界颜色
okBtn.layer.borderWidth = 1;
okBtn.layer.borderColor = [[UIColor lightGrayColor] CGColor];
//UIbutton上可以同时设置image和title,只要是widht和不大于button的width
[switchBtn setTitle:@"手动输入" forState:UIControlStateNormal];
[switchBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
[switchBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//设置Button上label和image的间距
[switchBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 20)]
[switchBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
//设置UIButton的圆角按钮
reIntoHouseBtn.layer.cornerRadius =10.0;
4.TableView加载json解析数据NSString *path = [[NSBundlemainBundle]pathForResource:@"data"ofType:@"json"];
NSData *jsonData = [NSDatadataWithContentsOfFile:pathoptions:NSDataReadingMappedIfSafeerror:nil];
id jsonObj = [NSJSONSerializationJSONObjectWithData:jsonDataoptions:NSJSONReadingAllowFragmentserror:nil];
NSMutableArray *arrayM = [jsonObjobjectForKey:@"data"];
NSMutableArray *tempArray = [[NSMutableArrayalloc]init];
for (NSDictionary *dictin arrayM) {
GoodsModel *goodsModel = [[GoodsModelalloc]init];
//给goodsModel赋值
[goodsModel setValuesForKeysWithDictionary:dict];
[tempArray addObject:goodsModel];
}
dataList = tempArray;
5.UIImageView上添加Button,不能触发点击事件------解决方案--------------------
因为UIImageView 默认是不接受Touch事件的
所以只要加上一句imgView.userInteractionEnabled = YES;
- 【ios开发学习】常见问题积累
- iOS常见问题及解决办法积累
- iOS开发技巧积累
- 【iOS开发】经验积累
- iOS开发常见问题若干
- IOS开发常见问题
- iOS开发的常见问题
- ios开发---常见问题
- iOS开发常见问题集
- iOS开发常见问题(二)
- ios开发中的常见问题
- iOS 开发常见问题
- iOS 开发常见问题(一)
- iOS 开发常见问题整理
- iOS开发常见问题
- ios开发常见问题
- IOS 开发常见问题列表
- iOS开发一些零碎积累
- Spark 编程基础
- MFC的tab控件用法
- 面试题之螺旋矩阵
- CentOS7 Docker安装操作以及基本命令
- sharepoint 页面登陆缓慢处理的一个方法!
- 【ios开发学习】常见问题积累
- eclipse中删除代码注释
- iOS app 适配问题总结
- 跨站脚本攻击(XSS)——常见网站攻击手段原理与防御
- js 对象动态属性
- 理解Cookie和Session机制
- pcl里面的RoPs特征(Rotational Projection Statistics)
- jQuery on()方法
- [算法练习]实现itoa,atoi