@@ -17,26 +17,6 @@ class HomeViewController: UIViewController {
1717 } ( )
1818
1919 override func viewDidLoad( ) {
20-
21- func customNavBar( ) {
22- let configNavBar = UINavigationBarAppearance ( )
23- configNavBar. backgroundColor = UIColor . systemBackground
24- navigationController? . navigationBar. standardAppearance = configNavBar
25- navigationController? . navigationBar. scrollEdgeAppearance = configNavBar
26- }
27-
28- func profilePictureNavBar( ) {
29- let profilePicture = UIView ( frame: CGRect ( x: 0 , y: 0 , width: 40 , height: 40 ) )
30- let image = UIImageView ( frame: CGRect ( x: 0 , y: 0 , width: 40 , height: 40 ) )
31- image. image = UIImage ( named: " avatar-placeholder " )
32- image. contentMode = . scaleAspectFit
33- image. layer. cornerRadius = 22.5
34- image. layer. masksToBounds = true
35- profilePicture. addSubview ( image)
36- let rightBarButton = UIBarButtonItem ( customView: profilePicture)
37- navigationItem. rightBarButtonItem = rightBarButton
38- }
39-
4020 customNavBar ( )
4121 profilePictureNavBar ( )
4222
@@ -56,4 +36,23 @@ class HomeViewController: UIViewController {
5636 override func loadView( ) {
5737 self . view = homeView
5838 }
39+
40+ private func customNavBar( ) {
41+ let configNavBar = UINavigationBarAppearance ( )
42+ configNavBar. backgroundColor = UIColor . systemBackground
43+ navigationController? . navigationBar. standardAppearance = configNavBar
44+ navigationController? . navigationBar. scrollEdgeAppearance = configNavBar
45+ }
46+
47+ private func profilePictureNavBar( ) {
48+ let profilePicture = UIView ( frame: CGRect ( x: 0 , y: 0 , width: 40 , height: 40 ) )
49+ let image = UIImageView ( frame: CGRect ( x: 0 , y: 0 , width: 40 , height: 40 ) )
50+ image. image = UIImage ( named: " avatar-placeholder " )
51+ image. contentMode = . scaleAspectFit
52+ image. layer. cornerRadius = 22.5
53+ image. layer. masksToBounds = true
54+ profilePicture. addSubview ( image)
55+ let rightBarButton = UIBarButtonItem ( customView: profilePicture)
56+ navigationItem. rightBarButtonItem = rightBarButton
57+ }
5958}
0 commit comments