ios - iOS7 UIButton image flashes -


i'm working on custom number pad , having issue background image of uibuttons. appears work should during push animations buttons flicker white in between each other. happens when popping view controller view numberpad. when change background color of enclosing view radical green flicker green, seems somehow background showing through. more pronounced , reproducible every time double click on home button. please see screenshots reference of things when it. buttons set follows:

_onebutton = [uibutton buttonwithtype:uibuttontypecustom]; //rinse , repeat rest of buttons _ninebutton = [uibutton buttonwithtype:uibuttontypecustom]; _clearbutton = [uibutton buttonwithtype:uibuttontypecustom];  nsarray *allbuttons = @[_zerobutton, _onebutton, _twobutton, _threebutton, _fourbutton,_fivebutton,_sixbutton,_sevenbutton,_eightbutton,_ninebutton, _deletebutton, _clearbutton]; [allbuttons enumerateobjectsusingblock:^(uibutton *button, nsuinteger idx, bool *stop) {     button.tag = idx;     [button settitle:@(idx).stringvalue forstate:uicontrolstatenormal];     [button setbackgroundimage:[[uiimage imagenamed:@"btn-numpad-resizeable.png"] resizableimagewithcapinsets:uiedgeinsetsmake(1, 1, 1, 1)] forstate:uicontrolstatenormal];     [button addtarget:self action:@selector(buttonpressed:) forcontrolevents:uicontroleventtouchupinside];     [self addsubview:button]; }]; 

for layout use autolayout, here example snippet of laying out first row, rest of constraints follow similar format.

[self addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|[_onebutton][_twobutton(==_onebutton)][_threebutton(==_onebutton)]|" options:0                                                              metrics:nil                                                                views:nsdictionaryofvariablebindings(_onebutton,_twobutton,_threebutton)]]; 

here final result when run:

result of numpad running

and following images of happens when double tap on homescreen. 1 double tap straight app , other double tap when not in app. it's interesting both yield different result. these results have been constant far every time try it. imagine push animation whole number pad switching between 3 states of screenshots , that's pretty seeing. enter image description hereenter image description here

things i've thought of / tried in order of relevancy:

  • some sort of problem image transparency? there no transparency in images , multiple sizes or difference images all-together cause same issue. resizable image doesn't affect things either. there 1 caveat , solid images created in code or provided png don't cause problem.

  • layout problem? don't think so. i've written both autolayout , overriding layoutsubviews , it's same. i've checked frames after view appears , views stacked next each other should be.

  • retina vs non retina problem? don't have not retina device , can't test this. xcode 5.1 gives me ios6 non retina simulator , haven't been able reproduce on ios6.

  • setting background color match orange of buttons. didn't work, things still flashed.

  • implement custom ios7 screenshot when app backgrounded. wouldn't solve issues when doing pushes our nav controller.

i'm @ loss of what's going wrong or how fix issue. it's possible there known bug haven't seen yet. have suggestions?

if working .xib file

here container option in xcode 5 ios7 .xib file design purpose.

go show size inspector option. go arrange check there container view set uibutton views. horizontally or vertically. please remove if any. may problem solve.

thanks


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -