我是Swift
的新手,确实需要一些帮助。
我有一个带有箭头图像的UIImageView
。我希望箭头在按钮上的方向随机改变,仅在三个方向上单击:顶部,右侧和底部。
我发现可以使用UIImageView
来旋转CGAffineTransform
,但是我该怎么办?
答案 0 :(得分:0)
产生一个随机数字:
@Entity
@NamedQuery(name = "Person.findByPhone",
query = "select p from Person as p join p.phoneNumbers as pn where pn.number = :number")
@Table(uniqueConstraints={
@UniqueConstraint(columnNames = {"lastName", "firstName", "patronymic"})
})
public class Person {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
private String lastName;
@NotNull
private String firstName;
private String patronymic;
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "person_phone_numbers", joinColumns = @JoinColumn(name = "person_id"))
private Set<PhoneNumber> phoneNumbers = new HashSet<>();
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "person_addresses", joinColumns = @JoinColumn(name = "person_id"))
@AttributeOverrides({
@AttributeOverride(name = "addressLine1", column = @Column(name = "house_number")),
@AttributeOverride(name = "addressLine2", column = @Column(name = "street"))
})
private Set<Address> addresses = new HashSet<>();
public Person() {
}
public Person(String lastName, String firstName, String patronymic,
Set<PhoneNumber> phoneNumbers, Set<Address> addresses) {
this.lastName = lastName;
this.firstName = firstName;
this.patronymic = patronymic;
this.phoneNumbers = phoneNumbers;
this.addresses = addresses;
}
getters and setters
}
答案 1 :(得分:0)