Add UINavigation Back button in UICollectionView with Swift 3

ساخت وبلاگ

Vote count: 0

I add Left Navigation Back button in collection view controller with code.

//Add Navigation Bar navbar.autoresizingMask = [.flexibleWidth, .flexibleBottomMargin, .flexibleRightMargin] navbar.delegate = self UINavigationBar.appearance().barTintColor = UIColor(red: 0.0/255.0, green:49.0/255.0, blue:79.0/255.0, alpha:0.1) UINavigationBar.appearance().tintColor = UIColor.white UINavigationBar.appearance().isTranslucent = true UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] navItem.title = prefs.value(forKey: "PROVIDER_NAME") as! String? let image = UIImage(named: "back_image") navItem.leftBarButtonItem = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(addTapped)) navItem.leftBarButtonItem?.imageInsets = UIEdgeInsetsMake(0, 0, 0, 0)


enter image description here
Back button is so close to the left. I would like to add padding about 10px from the left.
So, I changed the code into

 navItem.leftBarButtonItem?.imageInsets = UIEdgeInsetsMake(0, 15, 0, 0)

but it is not working and image Back button looks smaller. How can I do to add space to the left of Back button?

asked 31 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 471 تاريخ : سه شنبه 2 خرداد 1396 ساعت: 16:50