Wednesday 15 February 2012

ios - Cant hide a button? -



ios - Cant hide a button? -

i have button , set @ origin of programme , if seek hide or show right after set him works with:

button.hidden=yes; //set yes or no works ,

if seek later, when click on it, wouldn't disappear .

-(void)outb:(uibutton*)button { nslog(@"%@",button); //has pointer button.hidden=yes; butotnpointer.hidden=yes;

does not work .

here button :

//out self.outb = [uibutton buttonwithtype:uibuttontypecustom]; self.outb.contenthorizontalalignment=uicontrolcontenthorizontalalignmentcenter; self.outb.backgroundcolor=[uicolor colorwithred:0.0 green:0.0 blue:0.0 alpha:0.4]; [self.outb addtarget:self action:@selector(outb:)forcontrolevents:uicontroleventtouchupinside]; uiimage *outimage = [uiimage imagenamed:@"outbutton.png"]; [self.outb setimage:outimage forstate:uicontrolstatenormal]; self.outb.frame=cgrectmake(heart.frame.origin.x-bw, starty+(heart.frame.size.width-bh)/2.0, bw, bh); self.outb.backgroundcolor=[uicolor clearcolor]; [self.view addsubview:self.outb];

i see access button using public (probably) property

self.outb

then set attributes , add together button view

[self.view addsubview:self.outb];

if utilize iboutlet, lastly message redundant. don't need add together button subview because has been added. delete lastly stroke , seek again.

hope helps!

ios objective-c

No comments:

Post a Comment