Skip to content

Commit fa84ba8

Browse files
committed
fix ios7~
1 parent 0b77175 commit fa84ba8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Coding_iOS/Views/Search/CategorySearchBar.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@ @implementation CategorySearchBar
2020
-(void)layoutSubviews
2121
{
2222
self.autoresizesSubviews = YES;
23+
NSPredicate *finalPredicate = [NSPredicate predicateWithBlock:^BOOL(UIView *candidateView, NSDictionary *bindings) {
24+
if ([candidateView isMemberOfClass:NSClassFromString(@"UISearchBarTextField")]) {
25+
return true;
26+
}else{
27+
return false;
28+
}
29+
}];
30+
2331
//找到输入框 右移
24-
UITextField *searchField=[[[[self subviews] firstObject] subviews] lastObject];
32+
UITextField *searchField=[[[[[self subviews] firstObject] subviews] filteredArrayUsingPredicate:finalPredicate] lastObject];
2533
searchField.textAlignment=NSTextAlignmentLeft;
2634
[searchField setFrame:CGRectMake(53,4.8,self.frame.size.width-55,22)];
2735
//

0 commit comments

Comments
 (0)