ios - How can I change the alpha of selected and unselected carbonSegmentedControl items -
i'm trying change alpha of selected , unselected carbonsegmentedcontrol
items didn't able achieve instead of whole carbonsegmentedcontrol
alpha's changes. sample code follow:
uibutton *firstbutton = [[uibutton alloc]initwithframe:cgrectmake(0, 0, screen_width/items.count-10, 43)]; firstbutton.backgroundcolor = [uicolor colorwithred:0.0/255.0 green:75.0/255.0 blue:155.0/255.0 alpha:1.0]; firstbutton.layer.borderwidth = 3.0; firstbutton.layer.bordercolor = [uicolor whitecolor].cgcolor; [firstbutton settitle:buttontitles[0] forstate:uicontrolstatenormal]; firstbutton.titlelabel.font = [uifont proximanova_regular:16]; uiimage * firstbuttonimage = [self imageofbutton:firstbutton]; // uibutton *secondbutton = [[uibutton alloc]initwithframe:cgrectmake(0, 0, screen_width/items.count-10, 43)]; secondbutton.backgroundcolor = [uicolor colorwithred:18.0/255.0 green:209.0/255.0 blue:193.0/255.0 alpha:1.0]; secondbutton.layer.borderwidth = 3.0; secondbutton.layer.bordercolor = [uicolor whitecolor].cgcolor; [secondbutton settitle:buttontitles[1] forstate:uicontrolstatenormal]; secondbutton.titlelabel.font = [uifont proximanova_regular:16]; uiimage *secondbuttonimage = [self imageofbutton:secondbutton]; // uibutton *thirdbutton = [[uibutton alloc]initwithframe:cgrectmake(0, 0, screen_width/items.count-10, 43)]; thirdbutton.backgroundcolor = [uicolor colorwithred:251.0/255.0 green:252.0/255.0 blue:252.0/255.0 alpha:1.0]; thirdbutton.layer.borderwidth = 3.0; thirdbutton.layer.bordercolor = [uicolor colorwithred:194.0/255.0 green:243.0/255.0 blue:237.0/255.0 alpha:1.0].cgcolor; [thirdbutton settitle:buttontitles[2] forstate:uicontrolstatenormal]; thirdbutton.titlelabel.font = [uifont proximanova_regular:16]; [thirdbutton settitlecolor:[uicolor darkgraycolor] forstate:uicontrolstatenormal ]; uiimage *thirdbuttonimage = [self imageofbutton:thirdbutton]; imagesarray = [[nsarray alloc] initwithobjects:[firstbuttonimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal],[secondbuttonimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal],[thirdbuttonimage imagewithrenderingmode:uiimagerenderingmodealwaysoriginal],nil]; carbontabswipenavigation = [[carbontabswipenavigation alloc] initwithitems:imagesarray toolbar:_toolbar delegate:self]; [carbontabswipenavigation insertintorootviewcontroller:self andtargetview:self.view]; carbontabswipenavigation.carbonsegmentedcontrol.tintcolor = [uicolor clearcolor];
is there accomplish this? relevant welcome, thanks.
by setting aplha of carbonsegmentedcontrol
items in carbobkit
delegation carbontabswipenavigation
works me:
-(void)carbontabswipenavigation:(carbontabswipenavigation *)carbontabswipenavigation didmoveatindex:(nsuinteger)index{ carbontabswipenavigation.carbonsegmentedcontrol.segments[index].alpha = 1.0; (nsinteger =0; < carbontabswipenavigation.carbonsegmentedcontrol.segments.count; i++) { if(i != index) carbontabswipenavigation.carbonsegmentedcontrol.segments[i].alpha = 0.5; } }
Comments
Post a Comment