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

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

    خبرنامه

    عضویت

    نام کاربري :
    رمز عبور :