Posts

how to make login page in iphone using HTTP Post method

- (void)viewWillAppear:(BOOL)animated {     [super viewWillAppear:animated];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; } - (void)viewDidLoad {     [super viewDidLoad];     // Do any additional setup after loading the view from its nib.      // appDelegate=(AppDelegate*)[[UIApplication sharedApplication]delegate];  //   defaults=[NSUserDefaults standardUserDefaults];     usename_text.delegate=self;     password_text.delegate=self;       usename_text.layer.cornerRadius=3.0f;     usename_text.layer.masksToBounds=YES;     usename_text.layer.borderColor=[[UIColor whiteColor]CGColor];     ...

How to parse json data in UITableview using swift 3.0

import UIKit class ViewController : UIViewController , UITableViewDelegate , UITableViewDataSource {          @IBOutlet var table: UITableView !      //   var items: [String] = ["let's", "start", "Swift"]          var Namearray: [ String ] = []     var Email: [ String ] = []          override func viewDidLoad()     {         super . viewDidLoad ()                  table = UITableView (frame: UIScreen . main . bounds , style: UITableViewStyle . plain )         table . delegate       =   self         table . dataSource     =   self         table . register ( UITableViewCell . self , forCellReuseIdentifier: "cell" )         self . view . addSubvie...

How to make a simple tableview with iOS 8.2 and Swift 3.0

This is a step by step tutorial to add  UITableView  programmatically in  Swift . Create a new project     Open Xcode 8.2 and create a new project with "Single View Application" template. Create Table View Open default  ViewController.swift  file and add table view instance below class declaration import UIKit Add table view Delegate and DataSource Add  UITableViewDelegate  and  UITableViewDataSource  separated by comma after  UIViewController  in class declaration. class ViewController : UIViewController , UITableViewDelegate , UITableViewDataSource {          @IBOutlet var table: UITableView ! Add items as an Array of Strings and set some values in table view          var items: [ String ] = [ "let's" , "start" , "Swift" ]     override func viewDidLoad()     {         super . vi...

Parse JSON from a URL and showing data into UITableView

#import <UIKit/UIKit.h> @interface ViewController : UIViewController<UITableViewDelegate,UITableViewDataSource> {       IBOutlet UITableView *table_view;       NSMutableArray  *name_arr;     NSMutableArray  *num_arr;   } @end #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad {     [super viewDidLoad];   table_view.delegate = self;     table_view.dataSource = self;  NSString *jsonString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@“Your Url”]encoding:NSStringEncodingConversionAllowLossy error:nil];//Sample url:http://www.learnswiftonline.com/Samples/subway.json  NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding]options:0 error:NULL];     NSLog(@"jsonObject=%@", jsonObject);       NSMutab...

Parse JSON from a file and showing data into UITableView

Image
To create a json file in the project, File-->Other-->Empty as .json file and write the below content in the file and run. {     "Details" :     [      {      "Name" : "BatMan" ,      "Native" : "Gotham"      }     ] } #import <UIKit/UIKit.h> @interface ViewController : UIViewController<UITableViewDelegate,UITableViewDataSource> {       IBOutlet UITableView *table_view;       NSMutableArray  *name_arr;     NSMutableArray  *num_arr;   } @end #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad {     [super viewDidLoad];       NSString *filePath = [[NSBundle mainBundle] pathForResource:@"example" ofType:@"json"];     NSData *data = [NSData dataWithContentsOfFile:filePath]; ...

UITABLEVIEW IN AN APPLE WATCH APP

Image
In this post I’m going to show you how to create a  WKInterfaceTable  and set dynamic content in a list in a Watch app. Let’s start by creating a new project. Open Xcode 7.0 (or later) and click on  File > New > Project  (as shown below). Next, select the  iOS App  with WatchKit App option and click Next (as shown below). Enter the Product Name – this will be the name of your application. I’ve used the name ‘ MyFirstWatchApp ’. Click Next and choose the appropriate destination for creating the project. When you do that, XCode will automatically create a number of files and directories. Open the Interface.storyboard file under “ WatchKit App ”. Then, drag the  WKInterfaceTable  from the Object library to the  Interface Controller  (as depicted below). Now, drag the  WKInterfaceLabel  from the Object library to the newly created Table Row C...