ios - UISegmentedControl: how not to highlight already selected segment when using custom images -
ios - UISegmentedControl: how not to highlight already selected segment when using custom images -
i using custom images normal/selected states of uisegmentedcontrol
. when tap selected segment, it's appearance changes highlighted.
i've tried set image highlighted+selected state, it's ignored:
[segmentedcontrol setbackgroundimage:appearance.selectedbackground forstate:uicontrolstateselected | uicontrolstatehighlighted barmetrics:uibarmetricsdefault];
is there way (including non-breaking private ones) have selected segment in selected state when it's tapped again?
i know it's late have same issue: have set dividerimages each states
// set background images uiimage *normalbackgroundimage = [uiimage imagenamed:@"segmented-background-unselected"]; uiimage *selectedbackgroundimage = [uiimage imagenamed:@"segmented-background-selected"]; [self setbackgroundimage:normalbackgroundimage forstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; [self setbackgroundimage:selectedbackgroundimage forstate:uicontrolstateselected barmetrics:uibarmetricsdefault]; [self setbackgroundimage:normalbackgroundimage forstate:uicontrolstatehighlighted barmetrics:uibarmetricsdefault]; [self setbackgroundimage:selectedbackgroundimage forstate:uicontrolstateselected | uicontrolstatehighlighted barmetrics:uibarmetricsdefault]; // set divider images uiimage *buttonimageleftselected = [uiimage imagenamed:@"segmented-left-selected"]; uiimage *buttonimagenoneselected = [uiimage imagenamed:@"segmented-none-selected"]; uiimage *buttonimagerightselected = [uiimage imagenamed:@"segmented-right-selected"]; [self setdividerimage:buttonimagenoneselected forleftsegmentstate:uicontrolstatenormal rightsegmentstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; [self setdividerimage:buttonimageleftselected forleftsegmentstate:uicontrolstateselected rightsegmentstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; [self setdividerimage:buttonimageleftselected forleftsegmentstate:uicontrolstateselected | uicontrolstatehighlighted rightsegmentstate:uicontrolstatenormal barmetrics:uibarmetricsdefault]; [self setdividerimage:buttonimageleftselected forleftsegmentstate:uicontrolstateselected rightsegmentstate:uicontrolstatehighlighted barmetrics:uibarmetricsdefault]; [self setdividerimage:buttonimagerightselected forleftsegmentstate:uicontrolstatehighlighted rightsegmentstate:uicontrolstateselected barmetrics:uibarmetricsdefault]; [self setdividerimage:buttonimagerightselected forleftsegmentstate:uicontrolstatenormal rightsegmentstate:uicontrolstateselected | uicontrolstatehighlighted barmetrics:uibarmetricsdefault]; [self setdividerimage:buttonimagerightselected forleftsegmentstate:uicontrolstatenormal rightsegmentstate:uicontrolstateselected barmetrics:uibarmetricsdefault];
ios iphone objective-c uikit uisegmentedcontrol
Comments
Post a Comment