Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How i set the image on the segmented tab bar instead of title? #22

Closed
HariNarayanan777 opened this issue Nov 16, 2016 · 3 comments
Closed

Comments

@HariNarayanan777
Copy link

I try to set image on tab bar, but it won't come

Its come like this
simulator screen shot 16 nov 2016 13 28 25

I tried this code in the below function
firstViewController.tabBarItem.image = UIImage(named: "1-1.png")

func getSJSegmentedViewController() -> SJSegmentedViewController? {

    if let storyboard = self.storyboard {
        
        let headerViewController = storyboard
            .instantiateViewController(withIdentifier: "HeaderViewController1")
        
        let firstViewController = storyboard
            .instantiateViewController(withIdentifier: "FirstTableViewController")
        //firstViewController.title = "Table View"
        **firstViewController.tabBarItem.image = UIImage(named: "1-1.png")**
@subinspathilettu
Copy link
Owner

@HariNarayanan777 Currently we didn't add image support for segment tab. We will add this feature in next release and let you know.

@subinspathilettu
Copy link
Owner

subinspathilettu commented Nov 23, 2016

@HariNarayanan777 ,

We have added custom view support for segment tab in the latest version. For that, you need to provide your view for controller.navigationItem.titleView

// Custom ImageView
let view = UIImageView()
view.frame.size.width = 100
view.image = UIImage(named: imageName)
view.contentMode = .scaleAspectFit
view.backgroundColor = .white

firstViewController.navigationItem.titleView = view

@HariNarayanan777
Copy link
Author

@subinspathilettu super its working.......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants