사파리와 같은 새로 고침 로고를 iPad의 uisearchbar에 추가 할 수 있습니까? 아래 이미지가 마음에 드십니까?uisearchbar에 새로 고침 로고 추가
저는 uisearchbarcontroller와 uitableview가 있습니다. 새로운 화살표를 추가 할 수 있는지 궁금합니다. 검색 결과 및 북마크에 추가 할 수 있습니다.
감사합니다.사파리와 같은 새로 고침 로고를 iPad의 uisearchbar에 추가 할 수 있습니까? 아래 이미지가 마음에 드십니까?uisearchbar에 새로 고침 로고 추가
저는 uisearchbarcontroller와 uitableview가 있습니다. 새로운 화살표를 추가 할 수 있는지 궁금합니다. 검색 결과 및 북마크에 추가 할 수 있습니다.
감사합니다.예는 .. 여기 .. 당신의 새로 고침 작업을하는 사용자 정의 버튼을 지우기 버튼을 교체해야합니다 수는
UISearchBar *searchBar = yourSearchBar;
UITextField *searchtextfield = [searchBar.subviews objectAtIndex:1];
UIButton *cButton = [UIButton buttonWithType:UIButtonTypeCustom];
cButton.frame = CGRectMake(0, 0, 20 , 20);
cButton.backgroundColor = [UIColor clearColor];
[cButton setImage:[UIImage newImageFromResource:@"yourButtonImage"] forState:UIControlStateNormal];//refresh image.
cButton.contentMode = UIViewContentModeScaleToFill;
[cButton addTarget:self action:@selector(refreshButtonPressed) forControlEvents:UIControlEventTouchUpInside];//This is the custom event(refresh)
[searchtextfield setRightView:cButton];
[searchtextfield setRightViewMode:UITextFieldViewModeAlways];
즐길 것을 할 코드입니다 :
아이폰 OS 7의 대체 :
UITextField *searchtextfield = [searchBar.subviews objectAtIndex:1];
으로 :
UITextField *searchtextfield = [((UIView *)[searchBar.subviews objectAtIndex:0]).subviews lastObject];
,
감사합니다 !! 그게 도움이! – kraitz
iOS 7에서 작동하지 않습니까? –