16
Tôi đang cố gắng đặt màu bóng trên UIButton, nhưng tất cả những gì tôi dường như có thể nhận được là màu xám trung bình.Tại sao tôi không thể đặt màu bóng của nút?
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];
alt text http://img.skitch.com/20090825-xur3112ni5q2wrwwiix4jbcwc5.png
Am Tôi thiết lập thuộc tính sai, hoặc là nó theo cách mà tôi đang thiết shadowColor
đó là sai?
Cảm ơn.
Perfect, cảm ơn. Tôi đã bashing đầu của tôi cố gắng tìm ra lý do tại sao nó không hoạt động. –
Có cách nào chúng ta có thể thiết lập độ lệch bóng không? –
công việc bù đắp bóng như dự định: [button.titleLabel setShadowOffset: CGSizeMake (5.0f, 5.0f)]; – Vassily