rs / SDSegmentedControl

A drop-in remplacement for UISegmentedControl that mimic iOS 6 AppStore tab controls
MIT License
1.2k stars 180 forks source link

SDStainView backgroundColor is broken on iOS6 #58

Closed valeriomazzeo closed 10 years ago

valeriomazzeo commented 10 years ago

it appears black (because when it reaches drawRect self.backgroundColor is nil for some reasons).

even changing it from the uiappeareance protocol doesn't make any difference.

it looks like this a0ff092 doesn't work on iOS6 when compiled with the new sdk (xcode 5).

valeriomazzeo commented 10 years ago

move this stuff:

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)
        {
            self.innerStrokeLineWidth = 1.5;
            self.innerStrokeColor = UIColor.whiteColor;
            self.backgroundColor = [UIColor colorWithWhite:0.816 alpha:1];
            self.shadowOffset = CGSizeMake(0, .5);
            self.shadowBlur = 2.5;
            self.shadowColor = UIColor.blackColor;
        }
        else
        {
            self.backgroundColor = [UIColor clearColor];
        }

from initialize to init solves the problem, but I don't really know what you wanted to achieve...

y0hnn commented 10 years ago

OK yes, a real bug on iOS 6. When I load the view, it's ok (SDSegementedControl within view within nav controller). But when i push a new view and come back, error on

    [super setBackgroundColor:backgroundColor];

(l.1166)

But on iOS 7, everything is ok.

y0hnn commented 10 years ago

Here you see the call stack when we get back to the last view controllers containing SDSegmentedControl

screen shot 2013-10-16 at 2 44 05 pm

valeriomazzeo commented 10 years ago

it works on the example project, but not on mine... I can't understand what the difference is so far. I am not using interface builder.

y0hnn commented 10 years ago

Not using IB too... It is a MWPhotoBrowser which is pushed, and when i go back, horror...

valeriomazzeo commented 10 years ago

The example uses IB.

Also the other properties set with UIAppeareance work fine, just the background color does not.

valeriomazzeo commented 10 years ago

the problem was that the backgroundColor property for some reason was going in conflict with the original backgroundColor property of UIView. Using another name (backgroundColour) in this case, fix the problem.