This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (IBAction)tappedShowNewView:(id)sender { | |
| SecondViewController *secondViewController = | |
| [self.storyboard instantiateViewControllerWithIdentifier:@"secondViewController"]; | |
| [self presentModalViewController:secondViewController animated:YES]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @class SecondViewController; | |
| @protocol SecondViewControllerDelegate <NSObject> | |
| - (void)doSomethingWithSecondViewController:(SecondViewController *)secondViewController; | |
| @end | |
| @interface SecondViewController : UIViewController | |
| @property (nonatomic, weak) id <SecondViewControllerDelegate> delegate; | |
| - (IBAction)tappedCloseModal:(id)sender; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #import <UIKit/UIKit.h> | |
| @interface ViewController : UIViewController <NSURLConnectionDelegate> { | |
| NSMutableData* _receivedData; | |
| } | |
| @property (weak, nonatomic) IBOutlet UITextField *txtName; | |
| @property (weak, nonatomic) IBOutlet UILabel *lblData; | |
| - (IBAction)btnFetchData1:(id)sender; | |
| - (IBAction)txtFetchData2:(id)sender; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (IBAction)btnFetchData1:(id)sender { | |
| NSString *queryString = [NSString stringWithFormat:@"http://chrisrisner.com/Labs/day7test.php?name=%@", [self.txtName text]]; | |
| NSMutableURLRequest *theRequest=[NSMutableURLRequest | |
| requestWithURL:[NSURL URLWithString: | |
| queryString] | |
| cachePolicy:NSURLRequestUseProtocolCachePolicy | |
| timeoutInterval:60.0]; | |
| [theRequest setHTTPMethod:@"POST"]; | |
| NSURLConnection *con = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; | |
| if (con) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface ViewController : UIViewController <UITextViewDelegate, UITextFieldDelegate> | |
| @property (weak, nonatomic) IBOutlet UITextField *txtFieldOne; | |
| @property (weak, nonatomic) IBOutlet UITextField *txtFieldTwo; | |
| @property (weak, nonatomic) IBOutlet UITextView *txtView; | |
| @property (weak, nonatomic) IBOutlet UIButton *btnButton; | |
| - (IBAction)tappedButton:(id)sender; | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface AppDelegate : UIResponder <UIApplicationDelegate> | |
| @property (strong, nonatomic) UIWindow *window; | |
| @property (strong, nonatomic) NSString *info; | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (IBAction)tappedLoadData:(id)sender { | |
| NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
| self.lblInfo.text = [defaults objectForKey:@"infoString"]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface AppDelegate : UIResponder <UIApplicationDelegate> | |
| @property (strong, nonatomic) UIWindow *window; | |
| @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; | |
| @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; | |
| @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; | |
| - (void)saveContext; | |
| - (NSURL *)applicationDocumentsDirectory; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -(void)displayManagedObject:(NSManagedObject *)obj { | |
| self.txtName.text = [obj valueForKey:@"name"]; | |
| self.txtInfo.text = [obj valueForKey:@"info"]; | |
| self.txtNumber.text = [(NSNumber *)[obj valueForKey:@"number"] stringValue]; | |
| NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| [dateFormatter setDateStyle:NSDateFormatterMediumStyle]; | |
| self.lblCreateDate.text = [dateFormatter stringFromDate:[obj valueForKey:@"createDate"]]; | |
| self.lblUpdateDate.text = [dateFormatter stringFromDate:[obj valueForKey:@"updateDate"]]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"]; | |
| NSDictionary *item =[itemsArray objectAtIndex:[indexPath row]]; | |
| cell.textLabel.text = [item objectForKey:@"name"]; | |
| return cell; | |
| } |