1

In my Application, i have to use two rightBarButtonItem in UINavigationController with image in swift 3.0, I'm posting the Image below,

enter image description here

In the given image, i'm very worried about Create Account and Login rightBarbuttonItem's image, how do i add those images and the border between the buttons exactly like the given sample.

Any help will be appreciable.

Abhishek Mitra
  • 3,335
  • 4
  • 25
  • 46
  • 1
    you can achieve it by add UIButton & image & lable too – iPatel Apr 03 '17 at 11:19
  • @iPatel I have tried but failed to do that in swift with correct syntax. – Abhishek Mitra Apr 03 '17 at 11:20
  • 2
    @AbhishekMitra The simplest way is to create one UIView and put all this thing along with it and then create baritem using customView init – Nirav D Apr 03 '17 at 11:24
  • 1
    @AbhishekMitra - Yes as per Nirav's suggestion best way is hide navigation bar for this viewcontroller and make custom navigation bar (by use of uiview) as you want. – iPatel Apr 03 '17 at 11:26
  • 1
    @AbhishekMitra No need to hide the navigationBar, simply create the barbutton item from view an set it as rightItem – Nirav D Apr 03 '17 at 11:46
  • @NiravD What i'm trying in my code is to adding a subview in a uinavigation bar, but I'm doubting, if it is possible, your thought makes sense to me, but will you provide me some swift code, today is my first day in swift :/ with a complex designed project. – Abhishek Mitra Apr 03 '17 at 11:52
  • @AbhishekMitra Have you create xib, if yes then first simply create one UIView design for your create Account and login button with image and separator if this will done inform here – Nirav D Apr 03 '17 at 11:56
  • @NiravD Sir, Anand post his answer and I wanted the same what he posted there. thanks for your guidance too. – Abhishek Mitra Apr 03 '17 at 12:28

1 Answers1

1

What my work around is to add a UIView inside of navigation bar's title view and expend it as much as required and then you can place as much control as you want.

enter image description here

Anand Suthar
  • 3,678
  • 2
  • 30
  • 52