UITextField in a UITableViewCell
http://stackoverflow.com/questions/409259/having-a-uitextfield-in-a-uitableviewcell
http://stackoverflow.com/questions/7034433/how-to-get-uitextfield-values-when-button-is-clicked
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [self.tableLogin dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.selectionStyle = UITableViewCellSelectionStyleNone; if ([indexPath section] == ) {
UITextField *textfield = [[UITextField alloc] initWithFrame:CGRectMake(, , , )];
textfield.adjustsFontSizeToFitWidth = YES;
textfield.textColor = [UIColor blackColor];
textfield.backgroundColor = [UIColor whiteColor];
textfield.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support
textfield.autocapitalizationType = UITextAutocapitalizationTypeNone; // no auto capitalization support
textfield.textAlignment = UITextAlignmentLeft;
textfield.clearButtonMode = UITextFieldViewModeNever; // no clear 'x' button to the right
textfield.delegate = self; if ([indexPath row] == ) {
textfield.tag = ;
textfield.placeholder = @"your username";
textfield.keyboardType = UIKeyboardTypeDefault;
textfield.returnKeyType = UIReturnKeyNext;
}
else {
textfield.tag = ;
textfield.placeholder = @"required";
textfield.keyboardType = UIKeyboardTypeDefault;
textfield.returnKeyType = UIReturnKeyDone;
textfield.secureTextEntry = YES;
} [textfield setEnabled:YES];
[cell addSubview:textfield];
[textfield release];
}
}
if ([indexPath section] == ) { // Email & Password Section
if ([indexPath row] == ) { // Email
cell.textLabel.text = @"Email";
}
else {
cell.textLabel.text = @"Password";
}
}
else { // Login button section
cell.textLabel.text = @"Log in";
} return cell;
} - (BOOL)textFieldShouldReturn:(UITextField *)textField
{
switch (textField.tag) {
case :
self.username = textField.text;
break;
case :
self.password = textField.text;
break;
}
return true;
}
UITextField in a UITableViewCell的更多相关文章
- TableViewCell,TableView,UITableViewCell
这次的学习是在Navigation-based Application模板中,用RootViewController class设置操作方法,使用UITableView的属性值.在导航控制器控件为程序 ...
- 你真的了解UITableViewCell重用吗?
一:首先查看一下关于UITableViewCell重用的定义 - (nullable __kindof UITableViewCell *)dequeueReusableCellWithIdentif ...
- UITextField AutoComplete iOS输入框内文本自动完成
当你打开Safari的时候,输入网址,会有许多候选网址,点击后,自动填充到输入框,进入网页. 打开词典查单词的时候,输入前面部分字母,软件会给出符合的候选单词. 这样做的目的,是为了省去用户繁琐的输入 ...
- Swift - 给表格的单元格UITableViewCell添加图片,详细文本标签
表格UITableView中,每一单元格都是一个UITableViewCell.其支持简单的自定义,比如在单元格的内部,添加图片和详细文本标签. 注意UITableViewCell的style: (1 ...
- UITableView中cell里的UITextField不被弹出键盘挡住
UITableView中cell里的UITextField不被弹出键盘挡住 本人视频教程系类 iOS中CALayer的使用 效果如下: 源码: EditCell.h 与 EditCell.m // ...
- UITextField
UITextFieldDemo 效果 特点 1.有效定制键盘的样式 2.处理键盘对文本框的遮挡 用法 1.导入文件(UITextField+CreateInputAccessoryView.h/.m) ...
- UITableViewCell定制
UITableViewCell定制 效果 特点 1.可以添加不同的TableViewCell,可以定制不同的cell样式; 2.可以动态改变cell的高度; 3.可以随意摆放你cell的位 ...
- 自定义UITableViewCell实现左滑动多菜单功能LeftSwipe
今天愚人节,小伙们,愚人节快乐! 实现一个小功能,滑动菜单,显示隐藏的功能菜单, 先上图: 这里尝试用了下使用三个方式来实现了这个功能: 1.使用自定义UI ...
- 【ios开发】UITableViewCell的重用
移动开发需要解决的一个问题就是资源稀缺的问题.多数情况下是内存问题. 虽然现在的手机都号称大内存,高配置.但是移动app所占用的资源也在跟着不断膨胀, 也是造成内存不足的主要原因. 在前面的例子中,还 ...
随机推荐
- SpringBoot2 @validated 自定义效验类型
项目参考:详细参见:<Spring Boot 2精髓:从构建小系统到架构分布式大系统> 第三章 3.5.3节 自定义校验 项目结构 WorkTime package com.archibl ...
- Python - 连接msql数据库
可能出现的异常:python中出现SyntaxError: Non-UTF-8 code 解决方法 刚开始一直有用idle写代码,今天用了一下PyDev结果发现中文不支持,在网上搜了一下,结果发现解决 ...
- How get a String Width in Libgdx?
http://stackoverflow.com/questions/16600547/how-get-a-string-width-in-libgdx
- 用css3实现社交分享按钮
以前实现按钮一般都是用图片来实现的,特别是一些拥有质感的按钮,今天练习了一些相关方面的的例子,用css3来实现Social Media Buttons html代码如下 <div class=& ...
- CSS弹出背景半透明窗口
<script type="text/javascript" src="<ww:url value='/js/jquery-1.8.3.min.js'/> ...
- vmrun命令
VMWare提供了vmrun与VIX API两种手段使用户可以通过程序对虚拟机进行控制. 在官方文档中给出了详细的说明和示例代码. vmrun:http://www.vmware. ...
- SDRAM 学习笔记(一)
前面几篇博客已经讲到了关于0V7725的相关驱动问题,那么OV7725驱动成功之后,设定OV7725输出RGB565格式,那么对于640x480x16,那么若是选用FIFO,应该设置为位宽16bit, ...
- ViewPager自定义选项卡
转自:http://www.open-open.com/lib/view/open1352621601262.html
- 高斯分布与Gamma分布关系
https://math.stackexchange.com/questions/1917647/proving-ex4-3%CF%834
- js 获取单选框和复选框的值和js dom方法给单选框和多选框赋值
获取单选框框值的方法 function getRadioRes(Name){ var rdsObj = document.getElementsByName(Name); var checkVal = ...