如何在视图上方设计叠加指令?
I HAD 6 buttons....For Each Button I have To show Overlay For That, Before i click on that Button
假设...... 1)点击按钮就在我们需要的点击按钮上方 显示叠加,点击该按钮就像那样...
**
[我需要在所有按钮上使用此叠加菜单] [1]
**
答案 0 :(得分:0)
使用POST方法将参数发送到网络服务
以下是使用 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);
}
答案 1 :(得分:0)
请改用NSURLSession。 NSURLConnection已弃用。
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 :(得分:0)
为什么不使用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];
}
}];
你可以使用邮递员检查你的api
答案 3 :(得分:0)
将FirstViewController的这两个变量传递给SecondViewController,然后尝试在代码的下面放置代码。
以下是使用 NSURLSession 来发布数据的代码。
我希望这适合你。
-(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];
}