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)tappedSendFacebook:(id)sender { | |
SLComposeViewController *socialComposerSheet; | |
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) { | |
socialComposerSheet = [[SLComposeViewController alloc] init]; | |
socialComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; | |
[socialComposerSheet setInitialText:[NSString stringWithFormat:@"My Tweet!",socialComposerSheet.serviceType]]; | |
[self presentViewController:socialComposerSheet animated:YES completion:nil]; | |
} | |
[socialComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) { | |
NSString *output; |
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 <MessageUI/MessageUI.h> | |
@interface ViewController : UIViewController <MFMailComposeViewControllerDelegate> |
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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"LocalPage" ofType:@"html" inDirectory:nil]; | |
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil]; | |
//Append javascript | |
NSString *script = @"<script>alert(\"This is an alert!!\");</script>"; | |
htmlString = [htmlString stringByAppendingString:script]; | |
[self.webView loadHTMLString:htmlString baseURL:nil]; |
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; | |
} |
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
@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
- (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 (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
@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
- (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) { |