Giter Club home page Giter Club logo

Comments (26)

mruegenberg avatar mruegenberg commented on July 18, 2024

I get a crash with the latest version on Cocoapods (0.0.12) in UI7SegmentedControl, l. 57.

The crash happens because the attributes dictionary gets built with self.tintColor, which is nil for some reason.

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

Thank you for report. Which version of iOS did you tried?

from ui7kit.

mruegenberg avatar mruegenberg commented on July 18, 2024

This was on the iOS 6.1 Simulator.

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

Though I could not represent this problem, I found a hole in UI7View and fixed it.

from ui7kit.

kovpas avatar kovpas commented on July 18, 2024

The problem is that for some reason -[UISegmentedControl tintColor] returns _UISegmentedControlAppearanceStorage instead of UIColor after any of appearance methods is invoked (i.e. -[UISegmentedControl setBackgroundImage:forState:barMetrics:]). Solution is to save UIColor instance first and then use this saved value within _segmentedControlInit method. For me this fixed crash.

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

@kovpas ab5b667 fixed it like your patch?

from ui7kit.

kovpas avatar kovpas commented on July 18, 2024

@youknowone yep, thanks!

from ui7kit.

hamadeguchi avatar hamadeguchi commented on July 18, 2024

Crashes on real machine(runs successfully on simulator)
line 73:

    [self setDividerImage:self.tintColor.image
      forLeftSegmentState:UIControlStateNormal
        rightSegmentState:UIControlStateNormal
               barMetrics:UIBarMetricsDefault];

I traced logic, then I found difference between real and simulator.
Line 59 of UI7View.m

[self __tintColor]

returns nil on simulator. return non nil on real machine.
so I commented next if clause.
which is the best way to fix it?

the exception is following;
[_UISegmentedControlAppearanceStorage image]: unrecognized selector sent to instance XXXXX

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

@hamadeguchi Thank you for report! I fixed it and released new version.

from ui7kit.

hamadeguchi avatar hamadeguchi commented on July 18, 2024

Thank you for your quick response. I confirmed it solved!

FYI:
UI7BarButtonItem.m:118:12: Instance method '-_tintColor' not found (return type defaults to 'id')

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

Warning also removed. It will be included in next release.

from ui7kit.

gabrielribeiro avatar gabrielribeiro commented on July 18, 2024

I have a problem with this control when using in iPod 4th with iOS6. The segmented control present just a line in the middle of the text, very ugly.

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

@gribeiro-mobirama Sorry. Because I don't have iPod 4th, I couldn't test this control on it. Could you represent it on simulator? Or show me representable code for that?

from ui7kit.

gabrielribeiro avatar gabrielribeiro commented on July 18, 2024

Yes, in iPhone Simulator in Xcode DP2:

ios simulator screen shot 06 07 2013 09 30 42

My code:

NSDictionary * selectedAttributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                                   [UIColor whiteColor],
                                                   UITextAttributeTextColor,
                                                   nil];

    NSDictionary * deselectedAttributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
                                                     [UIColor redColor],
                                                     UITextAttributeTextColor,
                                                     nil];

    [segmentedControl setTitleTextAttributes:deselectedAttributesDictionary forState:UIControlStateNormal];
    [segmentedControl setTitleTextAttributes:selectedAttributesDictionary forState:UIControlStateSelected];

for (int i = 0; i < [segmentedControl.subviews count]; i++)
    {
        [[segmentedControl.subviews objectAtIndex:i] setTintColor:[UIColor redColor]];
    }

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

Unfortunately, I tried this code but didn't get that ugly stroke. (Test code is included current HEAD) But I found you are setting subview's tint colors. UI7Kit is implemented with all other codes, but is not touching subviews. How about try to set entier tint color like:

[segmentedControl setTintColor:[UIColor redColor]]

In your method, it will not change entire color theme but will change only partial parts.

About the stroke, I need more information. Try test app of current HEAD and check the #12 row in main table view. Test code is here: https://github.com/youknowone/UI7Kit/blob/master/UI7KitTestApp/UITIssue12ViewController.m#L30

from ui7kit.

gabrielribeiro avatar gabrielribeiro commented on July 18, 2024

Thanks a lot man! I did like you did, initializing the segmentedcontrol in ViewDidLoad with frame size. That worked fine, but in iOS6, just blue, not red. In iOS7, the red tint color worked normally. And clue about this tint color in iOS6? Am I doing shit again?

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

setTintColor: should work well in both OS. But it is fixed in recent days. So you may using unfixed UI7Kit yet. I updated UI7Kit just now. Try updating this.

If it still does not work after updating, it is UI7Kit bug. Please let me know it.

from ui7kit.

gabrielribeiro avatar gabrielribeiro commented on July 18, 2024

Thanks a lot! That worked fine! Great job!

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

@gribeiro-mobirama I found iOS7 SDK + Interface Builder + 3.5 inch screen can make this problem. Is this right? I didn't noticed this because i tested all the code from iOS6 SDK.

from ui7kit.

gabrielribeiro avatar gabrielribeiro commented on July 18, 2024

Yes. That ugly stroke just happened with me when under these conditions. If you could fix it, would be nice for others. To me, creating the segmetedcontrol programatically resolved. 👍

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

It is iOS7 SDK bug. (Without UI7Kit, it still is broken)
I think watching next beta is better at this time. If this would not fixed until release of iOS7, I will add a workaround.

from ui7kit.

jozsi avatar jozsi commented on July 18, 2024

screen shot 2013-07-25 at 7 22 57 pm

First one is added from Interface Builder & Autolayout. Stroke appears.
Second is added programatically.

Without Autolayout it's ok.
screen shot 2013-07-25 at 7 28 02 pm

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

Interesting information. Thank you @tracid

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

@gribeiro-mobirama @tracid I prevented UISegmentedControl's height become less than 1px. I found this helps problems, at least in some case.

from ui7kit.

jozsi avatar jozsi commented on July 18, 2024

Meanwhile I've updated to iOS7 SDK & Xcode 5 DP4. Running on the iOS 6.1 simulator, 0.6.1 still doesn't fix the problem (UISegmentedControl added to an autolayout XIB). But setting a constraint on the height to 29 works the problem around.

from ui7kit.

youknowone avatar youknowone commented on July 18, 2024

Depressing... I may should add constraint in the initWithCoder: for iOS6

from ui7kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.