- - (void)textFieldDidBeginEditing:(UITextField *)textField{
- NSArray *ws = [[UIApplication sharedApplication] windows];
- for(UIView *w in ws){
- NSArray *vs = [w subviews];
- for(UIView *v in vs){
- if([[NSString stringWithUTF8String:object_getClassName(v)] isEqualToString:@"UIPeripheralHostView"]){
- v.backgroundColor = [UIColor redColor];
- }
- }
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/091220137868.html
来源: http://www.codesnippet.cn/detail/091220137868.html