SDSegmentedControl icon indicating copy to clipboard operation
SDSegmentedControl copied to clipboard

Selection Indicator and its animation not working properly when control is subview of viewForHeaderInSection

Open inPhilly opened this issue 11 years ago • 2 comments

I made a comment on issue 18, asking for it to be reopened, but I will also post it here new in case those do not get looked at. As in issue 18, 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.

inPhilly avatar Apr 29 '13 17:04 inPhilly

Calling [self.tableview reloadData] on a delay (with performSelector) in the target action for the control seems to do the job, for now at least. I will try to post if I find anything different.

inPhilly avatar Apr 30 '13 22:04 inPhilly

Absolutely true, I confirm what @mommyme wrote, both the issue and the workaround.

fprosper avatar May 06 '13 22:05 fprosper