奔跑的香蕉Go 2015-10-31 08:45 采纳率: 55.6%
浏览 2502
已采纳

oc中在image view的view中添加一个textfield,textfield不能编辑?

UIImageView *person = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"geren"]];
person.frame = CGRectMake(10, 10, 300, 130);
UITextField *newPwd = [[UITextField alloc] initWithFrame:CGRectMake(95, 55, 185, 21)];
newPwd.borderStyle = UITextBorderStyleRoundedRect;
newPwd.autocorrectionType = UITextAutocorrectionTypeYes;
newPwd.placeholder = @"输入您的新密码";
newPwd.secureTextEntry = YES;
newPwd.returnKeyType = UIReturnKeyDone;
newPwd.clearButtonMode = UITextFieldViewModeWhileEditing;
[newPwd setBackgroundColor:[UIColor whiteColor]];
[person addSubview:newPwd];

  • 写回答

5条回答 默认 最新

  • 黑森林工作室 2015-11-01 05:47
    关注

    VIEW默认是不和用户交互的,所以要开启交互.userActivityEnable = YES

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作