Skip to content

Commit 795b872

Browse files
HSTHST
authored andcommitted
Botão com a foto de perfil implementado,sem a customização porque não recebe nenhuma imagem de profile
1 parent 0130680 commit 795b872

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

solutions/devsprint-caio-santos-7/FinanceApp/Screens/Home/HomeViewController.swift

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,28 @@ class HomeViewController: UIViewController {
1717
}()
1818

1919
override func viewDidLoad() {
20-
navigationItem.title = "Finance App 💰"
21-
navigationController?.navigationBar.prefersLargeTitles = true
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+
40+
customNavBar()
41+
profilePictureNavBar()
2242

2343
service.fetchHomeData { homeData in
2444
guard let homeData = homeData else {

0 commit comments

Comments
 (0)