UIButton sets the shadow effect and uibutton sets the shadow effect.
UIButton sometimes needs to use code to adjust the style, including adding a shadow.
As shown in the login button
In this case, you need to consider setting the button layer.
Button layer sets the following attributes
CornerRadius;
ShadowOffset
ShadowOpacity;
ShadowColor;
The Code is as follows:
LoginBtn = [UIButton buttonWithType: UIButtonTypeCustom]; loginBtn. frame = CGRectMake (10,120, 88, 36); loginBtn. backgroundColor = [UIColor colorwithred: 44/255. 0 green: 178/255. 0 blue: 219/255. 0 alpha: 1.0]; loginBtn. layer. cornerRadius = 5; loginBtn. layer. shadowOffset = CGSizeMake (1, 1); loginBtn. layer. shadowOpacity = 0.8; loginBtn. layer. shadowColor = [UIColor blackColor]. CGColor; [loginBtn setTitle: @ "login" forState: UIControlStateNormal]; [self. view addSubview: loginBtn];
Apple Development Group: 414319235 welcome to join discussions