0
검색 막대 옵션이있는 경고보기를 표시하려고합니다. 경고보기에서 검색 막대를 만들 수 있습니까? 나를 도와주세요. 모든 샘플 코드가 도움이 될 것입니다.아이폰의 검색 창을 사용하여 alertview를 만드는 방법은 무엇입니까?
감사합니다.
검색 막대 옵션이있는 경고보기를 표시하려고합니다. 경고보기에서 검색 막대를 만들 수 있습니까? 나를 도와주세요. 모든 샘플 코드가 도움이 될 것입니다.아이폰의 검색 창을 사용하여 alertview를 만드는 방법은 무엇입니까?
감사합니다.
검색 막대를 만들고 텍스트 상자를 하위보기로 추가했습니다.
UIAlertView * myAlertView = [[UIAlertView alloc] initWithTitle:@" "
message:@" "
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil, nil];
UISearchBar *myTextField = [[UISearchBar alloc] initWithFrame:CGRectMake(30.0, 35.0, 180.0, 35.0)];
UIButton *searchbtn = [[UIButton alloc] initWithFrame:CGRectMake(230.0, 35.0, 40.0, 35.0)];
[myTextField setBackgroundColor:[UIColor whiteColor]];
[myAlertView setBackgroundColor:[UIColor grayColor]];
[searchbtn setBackgroundColor:[UIColor grayColor]];
[myAlertView addSubview:myTextField];
[myAlertView addSubview:searchbtn];
더 좋은 방법이 있으면 알려 주시기 바랍니다.
더 나은 방법이있다 :
UIAlertView *myAlertView = [[[UIAlertView alloc] initWithTitle:@"Keyword Search"
message:@""
delegate:self
cancelButtonTitle:nil
otherButtonTitles:@"Search", nil] autorelease];
myAlertView.alertViewStyle = UIAlertViewStylePlainTextInput;
[myAlertView show];
그리고 위임에 :
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSString *searchTerm = [alertView textFieldAtIndex:0].text;
}