Files
Woka_Native_iOS/WOKA/SideBarNav/Controller/MyOrdersVC.swift
BilalKhanWDI 5a7750d012 - Completed My oders. Rest will be completed when shop module is finished.
- Internet issue
- Added api to get blogs, with data model decoding, inflating the collection view
- Added api to get the songs, with data model decoding , inflated tableview with dynamic height
- Added inline player for song list
2024-06-10 19:45:36 +05:30

72 lines
2.8 KiB
Swift

//
// MyOrdersVC.swift
// WOKA
//
// Created by MacBook Pro on 10/06/24.
//
import UIKit
class MyOrdersVC: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.title = "MY ORDERS"
// Create the button
let backbutton = UIButton(type: .custom)
backbutton.setImage(UIImage(named: "CartIcon"), for: .normal) // Image can be downloaded from the provided link
backbutton.setTitleColor(.black, for: .normal) // You can change the TitleColor
backbutton.addTarget(self, action: #selector(cartBtnTapped), for: .touchUpInside)
// Set button height and width
let buttonHeight: CGFloat = 60
let buttonWidth: CGFloat = 60
backbutton.translatesAutoresizingMaskIntoConstraints = false
backbutton.widthAnchor.constraint(equalToConstant: buttonWidth).isActive = true
backbutton.heightAnchor.constraint(equalToConstant: buttonHeight).isActive = true
// Create a container view for the button
let containerView = UIView(frame: CGRect(x: 0, y: 0, width: buttonWidth, height: buttonHeight))
containerView.addSubview(backbutton)
// Set constraints for the button inside the container view
NSLayoutConstraint.activate([
backbutton.centerYAnchor.constraint(equalTo: containerView.centerYAnchor),
backbutton.centerXAnchor.constraint(equalTo: containerView.centerXAnchor)
])
// Create a UIBarButtonItem with the custom view
let customBarButton = UIBarButtonItem(customView: containerView)
// Create a flexible space item to push the custom view to the left
let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
flexibleSpace.width = 20
// Create a negative spacer to fine-tune the position
let negativeSpacer = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
negativeSpacer.width = 10 // Adjust this value to move the button to the left
// Add the custom bar button and the spacer to the navigation bar
self.navigationItem.rightBarButtonItems = [flexibleSpace,negativeSpacer, customBarButton]
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.setNavigationBarHidden(true, animated: animated)
}
override func viewDidDisappear(_ animated: Bool) {
self.navigationController?.setColor(color: .black)
}
@objc func cartBtnTapped(){
}
}