mdinacci / MDRadialProgress

A custom UIView useful to represent progress in discrete steps.
Other
947 stars 159 forks source link

Incorrect constructor : awakeFromNib #15

Closed nicolasgoutaland closed 10 years ago

nicolasgoutaland commented 10 years ago

Hi,

thanks for your control.

I've found a bug when loading it from a XIB, and trying to initialize it in the awakeFromNib method of my cell.

In fact, you've implemented the awakeFromNib constructor. A component loaded from a XIB should implement initWithCoder: instead.

When using your control in a UICollectionViewCell for example, and trying to configure it in the awakeFromNib method of the UICollectionViewCell, the awakeFromNib method of your control is called after. So configuration aren't kept.

CustomCollecitonViewCell.h

- (void)awakeFromNib
{
    [super awakeFromNib];

    MDRadialProgressTheme *theme = _progressView.theme;
    theme.completedColor = [UIColor redColor];
    theme.centerColor = [UIColor whiteColor];
    theme.labelShadowColor = [UIColor blackColor];

    // _progressView is an outlet defined in the xib
    _progressView.theme = theme;
}

// Past this point, awakeFromNib method will be called in your MDRadialProgressView. Perhaps a change in iOS7 xib loading ?

To fix that, you have to replace your awakeFromNib method by the initWithCoder constructor.

Regards,

mdinacci commented 10 years ago

Hello Nicolas,

thank you for reporting this issue. I'll fix it and release a new version over the next few days.

mdinacci commented 10 years ago

Fixed in 1.0.6