如何设计视图上方的叠加说明?
I HAD 6 buttons....For Each Button I have To show Overlay For That, Before i click on that Button
假设。。。1)点击按钮在那里...在我们需要的点击按钮上方 显示覆盖层,单击该按钮 像那样...
**
[我需要像这样在所有按钮上覆盖菜单][1]
[1]: https://i.stack.imgur.com/dIjRF.jpg
**
请改用 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
}];
为什么不使用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
将 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];
}
使用 POST 方法将参数发送到 Web 服务
下面是使用 NSURLConnection 将数据发布到 Web 服务的代码。
-(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);
}