ios - Segue delays UIButton highlight -
please check edit 3
i have uibutton upon pressing need see grayed out immediately. im using code declaration:
uibutton *mybutton; mybutton = [[uibutton alloc] init]; //[uibutton buttonwithtype:uibuttontypecustom]; mybutton.frame = cgrectmake(132, 375, 40, 40); buttonimage = [uiimage imagenamed:@"chat.png"]; [mybutton setimage:buttonimage forstate:uicontrolstatenormal]; [mybutton addtarget:self action:@selector(mybuttoninvoked:)forcontrolevents:uicontroleventtouchdown]; [cell.contentview addsubview:mybutton];
and here's method button triggers
- (void) mybuttoninvoked:(id)sender { uibutton *catchbutton = (uibutton *)sender; cgpoint buttonposition = [sender convertpoint:cgpointzero toview:self.tableview]; nsindexpath *indexpath = [self.tableview indexpathforrowatpoint:buttonposition]; [uiview animatewithduration:5 delay:0.0 options:uiviewanimationoptionautoreverse | uiviewanimationoptionrepeat | uiviewanimationoptioncurveeaseinout animations:^{ catchbutton.alpha = 0.4; catchbutton.enabled = no; } completion:null]; [self performseguewithidentifier:@"heretothere" sender:self]; }
im using uianimation code make button grayed out upon pressing, notice has delay of 0, yet uibutton graying out delay. how can rid of delay? need mybutton gray out.
edit
i have tried adding commentsbutton.showstouchwhenhighlighted = yes;
, tried setting image button in uicontrolstatenormal , highlighted image same, gray.. delays well.
however, if place nslog
@ beginning of method, can see print upon touch of button, why cant update image? have tried following try , work:
a) highlighting
b) changing of image
c) changing of alpha of uibutton
i have put in method see if work.
catchbutton.highlighted = yes; [catchbutton setimage:[uiimage imagenamed:@"chathighlighted.png"] forstate:uicontrolstateselected | uicontrolstatehighlighted];
edit 2
i set simple uibutton same way @selector(methodhere:) , alpha changes immediately. there must other cause makes delay? super confused now.
edit 3 commenting out last line in mybuttoninvoked:
method above(see below):
[self performseguewithidentifier:@"heretothere" sender:self];
.. setting mybutton.alpha = 0.4
triggers immediately(visually) , problem gone. why happening, , how can around problem?
try this.
[uiview animatewithduration:0.0 //0.0 delay:0.0 options:uiviewanimationoptioncurveeaseinout//uiviewanimationoptionautoreverse | uiviewanimationoptionrepeat | animations:^{ catchbutton.alpha = 0.4; catchbutton.enabled = no; } completion:null];
delay happen: because using
animatewithduration = 5 second
Comments
Post a Comment