为什么我不能设置按钮的阴影颜色?

nev*_*ing 16 iphone cocoa-touch objective-c shadow uibutton

我正试图在UIButton上设置阴影颜色,但我似乎能得到的只是中灰色.

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(20, 20, 200, 100);

[button setTitle:@"a" forState:UIControlStateNormal];

[button addTarget:self 
           action:@selector(buttonPressed:) 
 forControlEvents:UIControlEventTouchUpInside];

[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button.titleLabel setFont:[UIFont fontWithName:@"Helvetica" size:96]];

// set up the button colours 
button.titleLabel.shadowColor = [UIColor blueColor];
[button.titleLabel setShadowOffset:CGSizeMake(5.0f, 5.0f)];

[self.view addSubview:button];
Run Code Online (Sandbox Code Playgroud)

替代文字http://img.skitch.com/20090825-xur3112ni5q2wrwwiix4jbcwc5.png

我设置了错误的属性,还是我设置错误的方式shadowColor

谢谢.

dre*_*lax 40

你有没有尝试过:

[button setTitleShadowColor:[UIColor blueColor] forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)