iOS中的关键字搜索

时间:2016-05-30 10:24:23

标签: ios objective-c iphone search xcode7

我是iOS新手。我有一个UITextfield和一个关键字搜索按钮。我什么时候想从服务中搜索关键字并按Enter键。 Tt应该显示来自服务的相关搜索关键字。请帮我解决这个问题? TIA!

- (IBAction)KeywordSearchClicked:(id)sender {

NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];

[self KeywordcallSignupProfileService:dict];

}


-(void)KeywordcallSignupProfileService:(NSMutableDictionary *)dict
{
[SVProgressHUD showWithStatus:@"" maskType:SVProgressHUDMaskTypeBlack]; // Progress
NSString * post = [[NSString alloc]initWithFormat:@"userId=%@&key_word%@",UserId,[dict objectForKey:@"key_word"]];
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.amarbiyashaadi.com/service/amarbiya-service.svc/userKeywordSearch/"]];
RBConnect = [[RBConnection alloc]init];
RBConnect.delegate = self;
[RBConnect postRequestForUrl:url postBody:post];

}

#pragma mark - MRConnection Delegate Methods

- (void)jsonData:(NSDictionary *)jsonDict
{
[SVProgressHUD dismiss];

NSMutableArray *jsonArr;
NSMutableDictionary *userDict,*dict;

NSArray *arr=[jsonDict allKeys];

jsonArr=[jsonDict objectForKey:@"DataTable"];

if (jsonArr.count>0) {
    // Save credentials in user defaults

    matchesProfileArr=[jsonArr mutableCopy];
    DisplayTableViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"DisplayTableViewController"];
    [self presentViewController:vc animated:YES completion:nil];

}
else
{

    NSString *error=@"Somthing Went Wrong";

    [SVProgressHUD showErrorWithStatus:error];

}
}

0 个答案:

没有答案