我有一个UITextField需要在右视图中显示一个按钮。
如何加载一个按钮,其图像与UITableViewCellAccessoryDetailButton中使用的信息图标相同?
答案 0 :(得分:0)
正如Rory McKinnel在评论中解释的那样,解决方案是:
UIButton *button=[UIButton buttonWithType:UIButtonTypeDetailDisclosure];
答案 1 :(得分:0)
//说这是你的文字字段
UITextField *txt = [[UITextField alloc]init];
//这是您添加信息按钮的方式
UIButton *yourButton = UIButton *button=[UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[yourButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
txt.rightView = yourButton;
txt.rightViewMode = UITextFieldViewModeAlways;
[self.view addSubview:txt];