ios--个人资料修改
2016-03-09 17:08
429 查看
点击进行编辑

(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCellIdentifier = @CustomCellIdentifier;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CustomCellIdentifier];
}
for (UIView *subview in cell.contentView.subviews) {
[subview removeFromSuperview];
}
UILabel *descLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 75, 30)];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(85, 10, 150, 30)];
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.delegate = self;
descLabel.font = [UIFont systemFontOfSize:18];
textField.font = [UIFont systemFontOfSize:16];
if ([indexPath row] == 0)
{
descLabel.text = @昵称;
textField.placeholder = @请输入昵称;
textField.tag = 0x1001;
textField.text = [HttpService getInstance].userBaseInfo.nickName;
}
else if([indexPath row] == 1)
{
descLabel.text = @手机;
textField.placeholder = @请输入手机号;
textField.tag = 0x1002;
textField.text = [HttpService getInstance].userBaseInfo.phone;
}
else if([indexPath row] == 2)
{
descLabel.text = @QQ;
textField.placeholder = @请输入QQ号;
textField.tag = 0x1003;
textField.text = [HttpService getInstance].userBaseInfo.qq;
}
else if([indexPath row] == 3)
{
descLabel.text = @支付宝;
textField.placeholder = @请输入支付宝账号;
textField.tag = 0x1004;
textField.text = [HttpService getInstance].userBaseInfo.alipayId;
}
else if([indexPath row] == 4)
{
descLabel.text = @推荐人;
textField.placeholder = @请输入推荐人账号;
textField.tag = 0x1005;
textField.text = [HttpService getInstance].userBaseInfo.referee;
}
[cell.contentView addSubview:descLabel];
[cell.contentView addSubview:textField];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}

点击事件


(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCellIdentifier = @CustomCellIdentifier;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CustomCellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CustomCellIdentifier];
}
for (UIView *subview in cell.contentView.subviews) {
[subview removeFromSuperview];
}
UILabel *descLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 10, 75, 30)];
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(85, 10, 150, 30)];
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.delegate = self;
descLabel.font = [UIFont systemFontOfSize:18];
textField.font = [UIFont systemFontOfSize:16];
if ([indexPath row] == 0)
{
descLabel.text = @昵称;
textField.placeholder = @请输入昵称;
textField.tag = 0x1001;
textField.text = [HttpService getInstance].userBaseInfo.nickName;
}
else if([indexPath row] == 1)
{
descLabel.text = @手机;
textField.placeholder = @请输入手机号;
textField.tag = 0x1002;
textField.text = [HttpService getInstance].userBaseInfo.phone;
}
else if([indexPath row] == 2)
{
descLabel.text = @QQ;
textField.placeholder = @请输入QQ号;
textField.tag = 0x1003;
textField.text = [HttpService getInstance].userBaseInfo.qq;
}
else if([indexPath row] == 3)
{
descLabel.text = @支付宝;
textField.placeholder = @请输入支付宝账号;
textField.tag = 0x1004;
textField.text = [HttpService getInstance].userBaseInfo.alipayId;
}
else if([indexPath row] == 4)
{
descLabel.text = @推荐人;
textField.placeholder = @请输入推荐人账号;
textField.tag = 0x1005;
textField.text = [HttpService getInstance].userBaseInfo.referee;
if (textField.text.length > 0) { textField.enabled = NO; }
}
[cell.contentView addSubview:descLabel];
[cell.contentView addSubview:textField];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}

点击事件

相关文章推荐
- 【iOS开发】MVC设计模式
- 一些iOS前辈的博客地址
- iOS alpha 和 hidden 的使用。
- iOS多语言工具genstrings for Localizable.strings
- coreData 深入理解3 (iOS5 以前线程安全与同步)
- iOS生命周期及loadView、viewDidLoad及viewDidUnload的关系
- CoreData 深入理解2 (iOS5 以后线程安全与同步)
- iOS中RunLoop机制浅探
- iOS tableviewCell的多行选择删除和全选删除
- iOS 自定义结构体、结构体转换成对象
- iOS崩溃分析
- ios修改textField的placeholder的字体颜色大小
- iOS runtime机制实现给分类添加属性
- Xcode插件 - iOS开发者最好的助手
- iOS本地通知
- iOS 基于Base64加密
- 160309iOS 浮点数显示的问题。
- atomic和nonatomic
- iOS安装CocoaPods的终端命令
- iOS 【iOS-NSString的常用方法】