如何在视图上渲染阴影?我尝试过shadowColor,shadowOffset,shadowOpacity和shadowRadius的许多组合,它们似乎什么都不做.我确信样式正确应用,因为我设置的其他属性工作.
I'd like to create a text field which uses the number pad and accepts only numbers, even when pasted. Currently, I have a header as such:
#import <UIKit/UIKit.h>
@interface DRPNumberTextField : UITextField <UITextFieldDelegate>
@end
Run Code Online (Sandbox Code Playgroud)
and an implementation:
#import "DRPNumberTextField.h"
@implementation DRPNumberTextField
- (id) initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self)
{
self.delegate = self;
[self setKeyboardType:UIKeyboardTypeNumberPad];
}
return self;
}
- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if ([string rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]].location != NSNotFound)
{
return NO;
} …Run Code Online (Sandbox Code Playgroud)