Comments added. Complete

This commit is contained in:
Brent Marohnic 2013-02-21 03:58:53 -05:00
parent aca2167653
commit 099e152608
5 changed files with 32 additions and 2 deletions

View File

@ -13,7 +13,7 @@
{
IBOutlet UITextView *mainTextView;
NSDateFormatter *dateFormatter;
}
-(IBAction)showSecondView:(id)sender;

View File

@ -27,6 +27,11 @@
// Dispose of any resources that can be recreated.
}
// Decalare an instance of ViewController2.
// Inform ViewController that it will be responsisble for processing any data transfered back
// from secondView via delegate.
// Show secondView.
-(IBAction)showSecondView:(id)sender
{
ViewController2 *secondView = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];
@ -39,6 +44,16 @@
}
}
// Begin by verifying that the user actually typed an event into the event text field.
// If a blank string is returned, then do nothing.
// Allocate a local NSMutableString that will be used to construct the final event entry.
// Allocate a local NSDateFormatter that will hold the date and time returned from secondView.
// Set the style for both the date and time portions of the date.
// Construct the final text view text by appending the new info returned from secondView to the
// existing text.
// Set the text view text equal to the newly constructed mutable string.
-(void)onClose:(NSString *)eventString pickerDate:(NSDate *)pickerDate
{
@ -47,7 +62,7 @@
NSMutableString *newTextViewText = [[NSMutableString alloc] initWithString:mainTextView.text];
dateFormatter = [[NSDateFormatter alloc] init];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];

View File

@ -14,6 +14,7 @@
@implementation ViewController2
// Synthesize delegate in order to allow for it to be accessed outside of this view.
@synthesize delegate;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
@ -28,6 +29,9 @@
return self;
}
// Set the minimum date of the date picker to the current date.
// Any attempt at selecting a date prior to today's date will not be allowed.
- (void)viewDidLoad
{
[super viewDidLoad];
@ -42,6 +46,9 @@
// Dispose of any resources that can be recreated.
}
// Call the onClose delegate and send back the text field text and the date picker date.
// Dismiss secondView.
-(IBAction)hideSecondView:(id)sender
{
if (delegate != nil)
@ -52,6 +59,10 @@
[self dismissViewControllerAnimated:TRUE completion:nil];
}
// iOS automatically triggers the keyboard once the user clicks inside the text field.
// Show the hide keyboard button and label.
// Hide the date picker label.
-(IBAction)onTextEnter:(id)sender
{
btnHideKeyboard.hidden = FALSE;
@ -60,6 +71,10 @@
}
// Force close the keyboard by calling the resignFirstResponder method on the event text field.
// Hide the keboard button and label.
// Show the date picker label.
-(IBAction)hideKeyboard:(id)sender
{
[eventTextField resignFirstResponder];