Ios 如何突出显示文本字段?

Ios 如何突出显示文本字段?,ios,ios7,Ios,Ios7,如果在textfield中没有写入任何内容,如何突出显示textfield并在几秒钟后删除辉光 if (_TextField.text.length == 0) { _TextField.layer.borderWidth = 0.5f; _TextField.layer.borderColor = [[UIColor redColor] CGColor]; _TextField.layer.cornerRadius = 5; _TextField.clipsTo

如果在textfield中没有写入任何内容,如何突出显示textfield并在几秒钟后删除辉光

if (_TextField.text.length == 0) {
    _TextField.layer.borderWidth = 0.5f;
    _TextField.layer.borderColor = [[UIColor redColor] CGColor];
    _TextField.layer.cornerRadius = 5;
    _TextField.clipsToBounds = YES;

}
else if (usersHighestLevel == 0 && [_TextField.text isEqualToString:@"2"]){
    usersHighestLevel = 1;
    intForString = intForString + 1;
    [self questions];}
else if (usersHighestLevel == 0 && ![_TextField.text isEqualToString:@"2"]) {
    usersHighestLevel = 1;
    _TextField.text = nil;
    [self questions];
}
else if (usersHighestLevel == 1 && [_TextField.text isEqualToString:@"green"]) {
    usersHighestLevel = 2;
    intForString = intForString + 1;
    [self questions];
}

1.导入quartzcore框架

2.添加阴影不透明度、阴影颜色。。。像这样,

_textField.layer.shadowOpacity = 1.0;   
_textField.layer.shadowRadius = 0.0;
_textField.layer.shadowColor = [UIColor blackColor].CGColor;
_textField.layer.shadowOffset = CGSizeMake(0.0, -1.0);

1.导入quartzcore框架

2.添加阴影不透明度、阴影颜色。。。像这样,

_textField.layer.shadowOpacity = 1.0;   
_textField.layer.shadowRadius = 0.0;
_textField.layer.shadowColor = [UIColor blackColor].CGColor;
_textField.layer.shadowOffset = CGSizeMake(0.0, -1.0);
希望这个能帮助你


希望这一条能帮助你……

我在问题中添加了到下一个问题的过渡中必须删除它。我在问题中添加了到下一个问题的过渡中必须删除它。几秒钟后如何删除阴影?@Alex现在检查我的答案,我在里面做了一些补充…我想这个有助于你,否则告诉我你是否需要更多帮助。几秒钟后如何移除阴影?@Alex现在检查我的答案,我在里面做了一些补充…我想这个有助于你,否则告诉我你是否需要更多帮助。。
[NSTimer scheduledTimerWithTimeInterval:2.0
                             target:self
                           selector:@selector(doSomethingWhenTimeIsUp:)
                           userInfo:nil
                            repeats:NO];
- (void) doSomethingWhenTimeIsUp:(NSTimer*)t {

    // YES! Do something here that you want to hide after few seconds!!
     [textField setBorderStyle:UITextBorderStyleNone];

}