app link:https://drive.google.com/open?id=0BwU5Y4Xqfa42SU1HUWpyNDQ2ckk
view.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *userTF;
@property (weak, nonatomic) IBOutlet UITextField *passwordTF;
- (IBAction)submitBtn:(id)sender;
@property NSURLSession *urlSession;
@property NSURLSessionDataTask *urlData;
@property NSMutableURLRequest *urlReq;
@property NSURLSessionConfiguration *urlConf;
@property NSMutableDictionary *dic;
@end
view.m
#import "ViewController.h"
#import "resultViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
_dic=[[NSMutableDictionary alloc]init];
_urlConf=[NSURLSessionConfiguration defaultSessionConfiguration];
_urlSession=[NSURLSession sessionWithConfiguration:_urlConf];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)submitBtn:(id)sender {
resultViewController *rvc=[self.storyboard instantiateViewControllerWithIdentifier:@"RVC"];
[self presentViewController:rvc animated:YES completion:^{
_urlReq=[[NSMutableURLRequest alloc]initWithURL:[NSURL URLWithString:@"http://www.brninfotech.com/pulse/modules/admin/ValidateLogin.php"]];
[_urlReq setValue:@"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[_urlReq setHTTPMethod:@"POST"];
NSString *post=[[NSString alloc]initWithFormat:@"registeredEmail=%@®isteredPassword=%@&funcName=%@",self.userTF.text,self.passwordTF.text,@"verifyLogin"];
NSData *postData=[post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength=[NSString stringWithFormat:@"%lu",(unsigned long)[postData length]];
[_urlReq setValue:postLength forHTTPHeaderField:@"Content-Length"];
[_urlReq setHTTPBody:postData];
_urlData =[_urlSession dataTaskWithRequest:_urlReq completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
_dic=[NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSLog(@"%@",_dic);
rvc.firstNameL.text=[_dic objectForKey:@"firstName"];
rvc.batchIDL.text=[_dic objectForKey:@"batchID"];
rvc.emailL.text=[_dic objectForKey:@"registeredEmail"];
rvc.studentIDL.text=[_dic objectForKey:@"studentID"];
rvc.surNameL.text=[_dic objectForKey:@"surName"];
// rvc.imageV.image=[_dic objectForKey:@"../uploads/Naresh_Kolindala/naresh photo.jpg"];
}];
[_urlData resume];
}];
}
@end
result.h
#import <UIKit/UIKit.h>
@interface resultViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *imageV;
@property (weak, nonatomic) IBOutlet UILabel *firstNameL;
@property (weak, nonatomic) IBOutlet UILabel *batchIDL;
@property (weak, nonatomic) IBOutlet UILabel *emailL;
@property (weak, nonatomic) IBOutlet UILabel *studentIDL;
@property (weak, nonatomic) IBOutlet UILabel *surNameL;
@end
result.m
#import "resultViewController.h"
@interface resultViewController ()
@end
@implementation resultViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
Sign up here with your email
2 comments
Write commentshow to display images u did not write code for that
Replydownload the project https://drive.google.com/open?id=0BwU5Y4Xqfa42SU1HUWpyNDQ2ckk
Replyu will get clearity on it
ConversionConversion EmoticonEmoticon