问题
How to Design the Overlay Instructions Above The View?
I HAD 6 buttons....For Each Button I have To show Overlay For That, Before i click on that Button
Suppose... 1) Click button is there...above the Click Button we need to show overlay for click on that button Like That...
**
[I Need Like This Overlay menu over the all Buttons][1]
[1]: http://i.stack.imgur.com/dIjRF.jpg
**
回答1:
Use NSURLSession instead. NSURLConnection is deprecated.
NSString *stringURL = [NSString stringWithFormat:@"%@?term=%@", BASE_URL, _inputText.text];
NSURL *URL = [NSURL URLWithString:stringURL];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionUploadTask *task = [session uploadTaskWithRequest:request fromData:yourData completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
// Do your stuff here
}];
回答2:
why not use alamofire---
NSDictionary *parameters = @{
@"email": @"myemail1@mailinator.com",
@"password": @"123456789",
@"accountnumber": @"LiM6N5gBBmqdlQBJGkqcP0h4OKwGbnzoWFcgTG3Z",
@"ifcscode": @"ABC"
};
NetworkHandler *networHandler = [NetworkHandler sharedInstance];
[networHandler composeRequestWithMethod:@"http://example.com/enpoint.json"
paramas: parameters
onComplition:^(BOOL success, NSDictionary *response){
if (success) { //handle success response
[self handleLoginResponse:response];
}
else{
ProgressIndicator *pi = [ProgressIndicator sharedInstance];
[pi hideProgressIndicator];
}
}];
you can use postman to check your api
回答3:
Pass this two variables of FirstViewController to SecondViewController and then try to put below code in place of your code.
Below is code to POST data using NSURLSession.
I hope this works for you.
-(void)postData
{
NSString *content = [NSString stringWithFormat:@"Name=%@&Email=%@&A/CName=%@&A/CNumber=%@&IFSCCode=%@&TypeOfAccount=%@",name,email,acName,acNumber,ifscCode,typeOfAccount];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:@"your web service url"]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[content dataUsingEncoding:NSUTF8StringEncoding]];
NSURLSession *session = [NSURLSession sharedSession];
[[session dataTaskWithURL:[NSURL URLWithString:londonWeatherUrl]
completionHandler:^(NSData *data,
NSURLResponse *response,
NSError *error) {
NSMutableDictionary *dictJson = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
NSLog(@"Dict Json :- %@",dictJson);
}] resume];
}
回答4:
Send Parameter to web service using POST method
Below is code to POST data to web service using NSURLConnection.
-(void)postData
{
NSString *content = [NSString stringWithFormat:@"email=%@&name=%@",textEmail.text,textName.text];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:@"your web service url"]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[content dataUsingEncoding:NSUTF8StringEncoding]];
[NSURLConnection connectionWithRequest:request delegate:self];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
dictJson = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
NSLog(@"Dict Json :- %@",dictJson);
}
来源:https://stackoverflow.com/questions/35765980/how-to-design-the-overlay-menu-above-the-home-page