cocoa touch - iOS: Issue modifying button's color -
i have following code in .h file:
#import <uikit/uikit.h> @interface scloginviewcontroller : uiviewcontroller @property (weak, nonatomic) iboutlet uibutton *btnlogin; @end
and following code in .m file:
- (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; // additional setup after loading view nib. // add gradient buttons btnlogin.layer.cornerradius = 10; cagradientlayer *gradientlayer = [cagradientlayer layer]; gradientlayer.frame = btnlogin.layer.bounds; gradientlayer.colors = [nsarray arraywithobjects: (id)[uicolor colorwithwhite:1.0f alpha:0.1f].cgcolor, (id)[uicolor colorwithwhite:0.4f alpha:0.5f].cgcolor, nil]; gradientlayer.cornerradius = btnlogin.layer.cornerradius; [btnlogin.layer addsublayer:gradientlayer]; // add shadow btnlogin.layer.shadowcolor = [uicolor darkgraycolor].cgcolor; btnlogin.layer.shadowopacity = 1.0; btnlogin.layer.shadowoffset = cgsizemake(2.0, 2.0); }
this how button sits on screen:
something horribly wrong though. know missing simple, can't figure out. created regular outlet called btnlogin change try make not working. button rounded rect button. tried custom button , didn't help.
thank you!
from image, see did not make connection btnlogin on nib file file's owner - .h file. line below has no connection button trying make changes.
@property (weak, nonatomic) iboutlet uibutton *btnlogin;
once make proper connection, should show btnlogin name referencing outlets on image provided.
Comments
Post a Comment