rs / SDSegmentedControl

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

Selection indicator animation is not working property #18

Closed thiagoperes closed 11 years ago

thiagoperes commented 11 years ago

Hi,

I don't know if you saw this, but the indicating arrow at the bottom is not animating properly. It only animates for the first time, than it will always be "behind".

header

rs commented 11 years ago

How do you reproduce?

thiagoperes commented 11 years ago

Just added a segmentedControl in a tableView.tableHeaderView and voilá. I reproduced with 2 and 3 segments.

Thiago Peres

Driven by passion. Fueled by innovation.

On Thursday, December 13, 2012 at 10:47 PM, Olivier Poitrey wrote:

How do you reproduce?

— Reply to this email directly or view it on GitHub (https://github.com/rs/SDSegmentedControl/issues/18#issuecomment-11360777).

rs commented 11 years ago

I use it that way with no pb

thiagoperes commented 11 years ago

That's weird… I'll make a video

Thiago Peres

Driven by passion. Fueled by innovation.

On Thursday, December 13, 2012 at 10:53 PM, Olivier Poitrey wrote:

I use it that way with no pb

— Reply to this email directly or view it on GitHub (https://github.com/rs/SDSegmentedControl/issues/18#issuecomment-11360907).

rs commented 11 years ago

A sample project reproducing the issue could help me understand the issue.

thiagoperes commented 11 years ago

Ok I'll try to reproduce in another project.

By the way, here's the error message I get: "Tried to load message that we have no information about.", this seems to be a UIKit / Foundation log message.

rs commented 11 years ago

Do you still have this issue with the last version?

thiagoperes commented 11 years ago

No, I managed to fix it when using in tableviews. I've added a property for the segmented control inside the view controller and I return it in viewForHeader.

Also, the error message doesn't seem to be related to SDSegmentedControl.

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return self.segmentedControlHeader;
}
inPhilly commented 11 years ago

I think this issue should be reopened. I am also using SDSegmentedContol in viewForHeaderInSection; if you return the control itself as the entire view, there is no problem; but if you add it as a subview to a view (that will also contain other components) - the problem remains; specifically, when there is action on the SDSegmentedContol, I have it reload the entire tableview; SDSegmentedContol itself is a PART of the tableview in viewForHeaderInSection; viewForHeaderInSection gets called and while SDSegmentedContol does not get recreated, it gets added to the view that is returned for the header in the section. This is how I MUST do this to achieve the tableview effect that I need. So each time a 'segment' is selected, the tableview is reloaded and this control is added to the viewForHeaderInSection, and the arrow fails to animate properly - it does not move to the correct segment. If I do the same thing with a regular UISegmentedControl, it works perfectly. This issue should most definitely be reopened.

thiagoperes commented 11 years ago

Could you provide a sample code? Maybe I can help you out.