현재 첫 번째 iOS 앱 인 ToDo Planner에서 작업 중입니다. 여기에 대한 레이아웃이 있습니다.하나의 UIButton, UILabel 및 UITextField가 모든 입력을 제어하는 방법
은 지금 나는 각 라인 자체에 textField, 버튼 (체크 표시 원)과 라벨 (파업 선)가 있는지에 설정해야합니다.
if(textField == textField1) // if the first text field is pressed
{
let image = UIImage(named: "To Be Completed Circle.png")
button1 = UIButton(frame: CGRect(x: 340, y: 56, width: 30, height: 30));
button1.setBackgroundImage(image, for: UIControlState.normal)
self.view.addSubview(button1)
button1.addTarget(self, action:#selector(self.pressCheck), for: .touchUpInside)
}
그리고이 :이처럼
if(button == button1) // if first button was pressed
{
button1.setBackgroundImage(image, for: UIControlState.normal) //set image to be of circle with checkmark
button1.removeTarget(nil, action: nil, for: .allEvents) //remove old target action
button1.addTarget(self, action:#selector(self.pressUnCheck), for: .touchUpInside) //add new target action for removing checkmark
self.view.addSubview(button1)
textField1.textColor = UIColor.gray //change textfield to a gray color
label1 = UILabel(frame: CGRect(x : 34, y : 70, width: 200, height: 2)) //add the strike line through textfield
label1.backgroundColor = UIColor(patternImage: labelImage!)
self.view.addSubview(label1)
}
은 Button1을 Label1을 모든 입력의 첫 번째 줄에 해당 텍스트 필드 1. Button2 Label2 textfield2 등 ...
텍스트 작성 도구는 인터페이스 작성 도구를 사용하여 작성되었으며 단추/레이블은 프로그래밍 방식으로 작성되었습니다. 모든 사용자 입력을 제어하기 위해 하나의 버튼 하나의 텍스트 필드와 하나의 텍스트 필드를 사용하는 방법이 있는지 궁금합니다. 버튼과 라벨은 기본적으로 모두 동일한 것입니다.
내가 너무 명확하지 않으면 알려주세요.
그냥 TableView 또는 tableViewController를 사용합니까? 아니면 둘다? – brownmamba
목록 이외의 페이지에 다른 UI 요소가 없으므로'TableViewController'를 사용할 수 있습니다. –