Swift 3: Twitter - Custom Navigation Bar (Ep 7)

preview_player
Показать описание
Let's go ahead and build out our custom navigation bar that includes all the various Twitter elements. This should be relatively straightforward by setting the necessary elements on UINavigationItem.

At the end of today's lesson, we'll go over how to clean up all the messy code by performing some easy refactoring. Also I'll show you how to use an extension to keep all this code in a separate file.

Enjoy.

Completed Source Code:

Swift Basic Training Course:

Рекомендации по теме
Комментарии
Автор

You have a talent for speaking about the important things and working at the same time and I don't want to miss any of it. :) Well done and thanks for sharing

BreakingBarriersDIY
Автор

Dude I have titled you as my mentor, cheers :)

mirsha
Автор

This guy is such a PRO! Cheers man. Sure you been puttin' in the work.

laundrytown
Автор

have been following your tutorials, which are all very practical and helpful. And i do notice things are speeding up a lot. Can not wait for those backend implementation for this video. Keep up the good work!!!

timing
Автор

Loving the videos. I'm getting into non-storyboard stuff and this course has been great. The only thing I would add is in your refactoring of the buttons, I probably would have created a private method to initialize each button. There was a lot of shared code between those implementations. Small nitpick that I imagine you pick up in your production code, but anyone unfamiliar with refactoring might want to be aware of. Thanks again!

derekstepan
Автор

Thanks for your many videos Brian. It seems you are alwayse standing while making this series.

dillionwang
Автор

Great work Brian. I have a suggestion if you don't mind.

Would you consider replacing for instance, the search bar with a floating search bar. With that you will accomplish two things..
1- Cleaner and great UX insted of population the nav bar with buttons.
2- Implementing a new feature to your already pronominal work

Just thought about leaving that here hoping it might help in the future.

fleonardo
Автор

Thanks Brian. Your videos are a real knowledge hub. I tried customizing the nav bar as you did. But the title image moves to the right after I add the left bar button. I do not have a right bar button in my project.

sanawfal
Автор

A video to look forward to after work! :)

Inpon
Автор

I have gone through so many of your videos for my assignment, thank you so much!

SivRami
Автор

Thanks Brian for the work and your time. You can use fileprivate instead private in VC Extension and it will work.

abdouett
Автор

Notice that the method to set navigation bar button items' sizes does not work in swift4+.
"searchButton.frame = CGRect" will not change the size and the item will be shown whether this code is added or not.

Use codes below to set button image size:

34).isActive = true
34).isActive = true

tianshiwei
Автор

Another awesome video Brian! The best on Youtube!

young_vz
Автор

Hello Brian, I think that Apple recommend minimum button size as 44*44px ( Check HIG : Human Interface Guidelines) while you're using buttons with 34*34 px.

aymenchouirfi
Автор

For anyone trying to resize the view and not seeing it resize. The title view's layout is under the auto-layout system now. Use constraints rather than it's frame property.

thestoryofrobb
Автор

Thanks so much for this series! Quick question: I'm trying to set the frame on the nav buttons to make them smaller, but they aren't changing size at all? I also tried using autolayout constraints to make them smaller but still they won't adjust at all. Any ideas?

alecmather
Автор

Another way to to move codes to another file is by create base class. This base class is mainly for navigation customization. The advantage of base class is that viewDidLoad can be called so that only customization codes for navigation bar will be called. For the case of extension, there is only one viewDIdLoad() func, and it seems very difficult to have other none-navigation-bar-codes in this load event.

chudq
Автор

May I have two questions.
1. When I am adding the right buttons, the titleImage will offset from the center. Can I recenter the titleImage like the blue bird for this video.
2. How can I change the image size for the right buttons through the codes? For example, my icon image may be 120 x 120.

Thank you. I am looking forward to hearing back that.

wesleyli
Автор

Nice tutorial bro.
Can you please put this series in a playlist so one can follow it sequentially?

Thanks a bunch!

aweklin
Автор

hi, I have a question if I know only swift without objective-c is that problem if apply for a job?

Ilyesbensalem