<一>设置输入框UITextField只可以输入固定长度
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textFieldChanged:)
name:UITextFieldTextDidChangeNotification
//执行方法为
-(void)textFieldChanged:(id)text{
if (self.phoneNum.text.length > 11) { //设置可输入11位
self.phoneNum.text = [self.phoneNum.text substringToIndex:11];
}
}
<二>实现从页面底部推出页面:
使用页面跳转模态实现:
loadingViewController *loadingVC = [[loadingViewController alloc] init];
[self presentViewController:loadingVC animated:YES completion:^{ //在当前界面推出 loadingViewController界面
}];
//在loadingViewController界面中取消推出界面, 回到原界面
[self dismissViewControllerAnimated:YES completion:^{
}];
<三>实现UITextField中粘帖为汉字
在程序的Info.plist中将其设置为china如下:
<四>关于tableView中cell的有关设置
点击时cell的背景图片,系统默认的有(即cell选中时的样式)
1.无色 cell.selectionStyle = UITableViewCellSelectionStyleNone;
2.蓝色 cell.selectionStyle = UITableViewCellSelectionStyleBlue;
3.灰色 cell.selectionStyle = UITableViewCellSelectionStyleGray;
也可以自定义点击时cell的背景图片
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”btn_two_hover”]];
自定义点击时cell的背景颜色
cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame];
cell.selectedBackgroundView.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1];
点击时cell的字体颜色
cell.textLabel.highlightedTextColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1];
设置cell间的分割线颜色
[theTableView setSeparatorColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1 ]];