我在视图上有一些按钮。我不知道有多少,我知道它可以是最小值2或最多4个。我想检查每个按钮的标题文本并根据标题值添加到数组true或false。
有可能吗?
答案 0 :(得分:1)
是的,可以遍历视图中的所有对象。要查看视图中显示的所有子视图,您可以执行以下操作:
<?php
if(isset($_POST['submit']))
{
$id=$_SESSION['id'];
//$date1=date("Y-m-d");
//echo $date1;
$work=$_POST['postinput0'];
//echo $work;
$project_name=$_POST['postinput1'];
$skills=$_POST['postinput2'];
$description=$_POST['postinput3'];
$file1=$_POST['file1'];
$budget=$_POST['postinput4'];
//$radio=$_POST['radio'];
$sql = "INSERT INTO Job_post (u_id,job_category,project_name,job_sub_category,project_description,image,budget) VALUES('$id','$work','$project_name','$skills', '$description','$file1','$budget')";
$query = mysql_query( $sql, $conn );
if(isset($query))
{
echo "successfully";
}
else
{
echo "not successfully inserted";
}
}
?>
答案 1 :(得分:1)
尝试下面的事情..
for view in self.view.subviews {
if view.isKindOfClass(UIButton){
// Add you logic over here.
// you can check the tag of button as well.
}
}