iphone - How to hide info button in ZBar Bar Code Reader for iOS6.0 and above -
i using zbar bar code reader ios 5.0 , above in ios app.
i have made info button hidden using following code on camera interface.
uiview * infobutton= infobutton = [[[[[reader.view.subviews objectatindex:1] subviews] objectatindex:0] subviews] objectatindex:2]; [infobutton sethidden:yes];
but somehow code doesn't work ios6.0 , above.
try code, worked me on ios5.0 , above.
float currentversion = 5.1; float sysversion = [[[uidevice currentdevice] systemversion] floatvalue]; uiview * infobutton; if (sysversion > currentversion) infobutton = [[[[[reader.view.subviews objectatindex:1] subviews] objectatindex:0] subviews] objectatindex:3]; else infobutton = [[[[[reader.view.subviews objectatindex:1] subviews] objectatindex:0] subviews] objectatindex:2]; [infobutton sethidden:yes];
explanation. in ios 6.0, if print log.
nslog(@"%@",[[[[reader.view.subviews objectatindex:1] subviews] objectatindex:0] subviews]);
output.
"<_uitoolbarbackground: 0xa0991c0; frame = (0 0; 320 54); autoresize = w; userinteractionenabled = no; layer = <calayer: 0xa0795e0>>", "<uiimageview: 0xa05d630; frame = (0 -3; 320 3); opaque = no; autoresize = w+bm; userinteractionenabled = no; layer = <calayer: 0xa05cfb0>>", "<uitoolbartextbutton: 0xa0a8cc0; frame = (6 0; 60 54); opaque = no; layer = <calayer: 0xa0a9460>>", "<uibutton: 0xa0960e0; frame = (290 18; 18 19); opaque = no; layer = <calayer: 0xa0615a0>>
in ios 5.0, if print log.
nslog(@"%@",[[[[reader.view.subviews objectatindex:1] subviews] objectatindex:0] subviews]);
output.
"<_uitoolbarbackground: 0x8d9df90; frame = (0 0; 320 54); userinteractionenabled = no; layer = <calayer: 0x8dc12c0>> - (null)", "<uitoolbartextbutton: 0x8de5ae0; frame = (6 0; 60 54); opaque = no; layer = <calayer: 0x8de5db0>>", "<uibutton: 0x8d1b110; frame = (290 18; 18 19); opaque = no; layer = <calayer: 0x8dba2b0>>"
hence ios 6.0 , above should object @ index 3 since there view uiimageview.
Comments
Post a Comment