Commit 364946d9 by Julio Hermosa

se agregan las imágenes de los pedidos

parent e5f3a7a2
......@@ -19,9 +19,9 @@ class Format{
let bodyTextColor = UIColor(displayP3Red: 10/255, green: 10/255, blue: 10/255, alpha: 1)
let dateTextColor = UIColor(displayP3Red: 50/255, green: 50/255, blue: 50/255, alpha: 1)
let dateFontStyle = UIFont.systemFont(ofSize: 10)
let titleFontStyle = UIFont.boldSystemFont(ofSize: 18)
let bodyFontStyle = UIFont.systemFont(ofSize: 15)
let subTitleFontStyle = UIFont.systemFont(ofSize: 16)
let titleFontStyle = UIFont.boldSystemFont(ofSize: 16)
let bodyFontStyle = UIFont.systemFont(ofSize: 14)
let subTitleFontStyle = UIFont.systemFont(ofSize: 15)
}
extension String{
......
......@@ -72,32 +72,37 @@ class RequestViewController: UIViewController {
dateLabel.text = "Publicado el \(day) de \(month) de \(year) a las \(hour)"
dateLabel.font = format.dateFontStyle
dateLabel.textColor = format.dateTextColor
dateLabel.heightAnchor.constraint(equalToConstant: 14).isActive = true
//titulo del pedido
let titleLbl = UILabel()
titleLbl.text = "\(hRequestTitle)"
titleLbl.font = format.titleFontStyle
titleLbl.textColor = format.titleTextColor
dateLabel.heightAnchor.constraint(equalToConstant: 18).isActive = true
//detalle del pedido
let messageLabel = UILabel()
messageLabel.text = "\(message)"
messageLabel.font = format.bodyFontStyle
messageLabel.numberOfLines = .max
messageLabel.lineBreakMode = .byWordWrapping
messageLabel.sizeToFit()
//print("ha upei \()")
//messageLabel.sizeToFit()
//Para mostrar la imagen en caso de que el campo no sea nulo
let imageView = UIImageView()
if imageUrl != nil {
imageView.layer.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
imageView.heightAnchor.constraint(equalToConstant: view.frame.width * 0.4).isActive = true
imageView.widthAnchor.constraint(equalToConstant: view.frame.width * 0.4).isActive = true
imageView.kf.indicatorType = .activity
imageView.kf.setImage(with: URL(string: imageUrl!))
imageView.kf.setImage(with: URL(string: imageUrl!.convertURL()))
}
//Se agrupan las vistas en la cabecera
let headerStackView = UIStackView(arrangedSubviews: [dateLabel, titleLbl, messageLabel])
let headerStackView = UIStackView(arrangedSubviews: [dateLabel, titleLbl, messageLabel, imageView])
headerStackView.axis = .vertical
headerStackView.spacing = 5
headerStackView.distribution = .equalSpacing
headerStackView.alignment = .leading
//Dirección y como llegar
let addressSubTittle = UILabel()
......@@ -114,8 +119,10 @@ class RequestViewController: UIViewController {
howToGetButton.setTitle("Como llegar", for: .normal)
howToGetButton.addTarget(self, action: #selector(openGoogleMapsLink), for: .touchUpInside)
howToGetButton.titleLabel?.font = format.subTitleFontStyle
howToGetButton.heightAnchor.constraint(equalToConstant: 24).isActive = true
let addressStackView = UIStackView(arrangedSubviews: [addressSubTittle, addressLabel, howToGetButton])
addressStackView.axis = .vertical
addressStackView.distribution = .equalSpacing
addressStackView.spacing = 5
//Información del Contacto
......@@ -131,8 +138,10 @@ class RequestViewController: UIViewController {
contactNumberButton.layer.cornerRadius = 10
contactNumberButton.setTitle("\(phoneNumber)", for: .normal)
contactNumberButton.addTarget(self, action: #selector(call), for: .touchUpInside)
contactNumberButton.heightAnchor.constraint(equalToConstant: 24).isActive = true
let contactInformationStackView = UIStackView(arrangedSubviews: [contactLabel, contactNameLabel, contactNumberButton])
contactInformationStackView.axis = .vertical
contactInformationStackView.distribution = .fillEqually
contactInformationStackView.spacing = 5
//Se muestra el botón y la etiqueta de marcar como listo
......@@ -173,11 +182,15 @@ class RequestViewController: UIViewController {
//Se agregan las vistas en un stack view vertical para que se vean ordenadamente, adaptando a la pantalla del dispositivo
let stackView = UIStackView(arrangedSubviews: [headerStackView, addressStackView, contactInformationStackView, footerStackView])
stackView.axis = .vertical
stackView.distribution = .equalSpacing
stackView.spacing = 10
stackView.layer.frame = CGRect(x: 20, y: 20, width: view.frame.width - 20 , height: view.frame.height*0.9)
stackView.distribution = .equalCentering
stackView.spacing = 5
stackView.layer.frame = CGRect(x: 20, y: 20, width: view.frame.width - 40 , height: view.frame.height*0.9)
view.addSubview(stackView)
let scrollView = UIScrollView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height))
scrollView.addSubview(stackView)
//view.addSubview(stackView)
view.addSubview(scrollView)
print(stackView.spacing)
}
func isReadyCheck()->Bool{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment