
MemoData.h
#import <Foundation/Foundation.h>
@interface MemoData : NSObject
{
NSInteger mIndex;
NSString *mTitle;
NSString *mContent;
NSString *mDate;
}
@property(nonatomic, assign) NSInteger mIndex;
@property(nonatomic, retain) NSString *mTitle;
@property(nonatomic, retain) NSString *mContent;
@property(nonatomic, retain) NSString *mDate;
- (id)initWithData:(NSInteger)pIndex Title:(NSString *)pTitle Content:(NSString *)pContent Date:(NSString *)pDate;
@end
MemoData.m
#import "MemoData.h"
@implementation MemoData
@synthesize mIndex;
@synthesize mTitle;
@synthesize mContent;
@synthesize mDate;
- (id)initWithData:(NSInteger)pIndex Title:(NSString *)pTitle Content:(NSString *)pContent Date:(NSString *)pDate
{
self.mIndex = pIndex;
self.mTitle = pTitle;
self.mContent = pContent;
self.mDate = pDate;
return self;
}
@end
MemoPadAppDelegate.h
#import <UIKit/UIKit.h>
#import <sqlite3.h>
@interface MemoPadAppDelegate : UIResponder <UIApplicationDelegate>
{
UIWindow *window;
UINavigationController *navigationController;
NSString *DBName;
NSString *DBPath;
NSMutableArray *DBData;
BOOL isFirstTimeAccess;
}
@property (retain, nonatomic) IBOutlet UIWindow *window;
@property (retain, nonatomic) IBOutlet UINavigationController *navigationController;
@property (retain, nonatomic) NSString *DBName;
@property (retain, nonatomic) NSString *DBPath;
@property (retain, nonatomic) NSMutableArray *DBData;
@property (assign) BOOL isFirstTimeAccess;
@property (nonatomic, assign) NSInteger currentMemoSQLIndex;
@property (nonatomic, assign) NSInteger currentMemoRowIndex;
- (void)checkAndreateDatabase;
- (void)readMemoFromDatabase;
- (void)writeMemoToDatabaseWithTitle:(NSString *)inputTitle Content:(NSString *)inputContent;
- (void)updateMemoToDatabaseWithTitle:(NSString *)inputTitle Content:(NSString *)inputContent;
- (void)deleteMemoFromDatabase;
@end
MemoPadAppDelegate.m
#import "MemoPadAppDelegate.h"
#import "RootViewController.h"
#import "MemoData.h"
@implementation MemoPadAppDelegate
@synthesize window;
@synthesize navigationController;
@synthesize DBData;
@synthesize DBName;
@synthesize DBPath;
@synthesize isFirstTimeAccess;
@synthesize currentMemoRowIndex;
@synthesize currentMemoSQLIndex;
- (void)dealloc
{
[window release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// 최초 액세스인가?
self.isFirstTimeAccess = TRUE;
// 앱의 파일 시스템 경로를 구한다.
NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [documentPaths objectAtIndex:0];
// 데이터베이스 이름과 경로를 저장한다.
self.DBName = @"MemoPad.db";
self.DBPath = [documentsDir stringByAppendingPathComponent:self.DBName];
[self checkAndreateDatabase];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
return YES;
}
- (void)checkAndreateDatabase
{
NSFileManager *fileManager = [NSFileManager defaultManager];
if([fileManager fileExistsAtPath:self.DBPath])
{
return;
}
else
{
NSString *databasePathFromApp = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:self.DBName];
[fileManager copyItemAtPath:databasePathFromApp toPath:self.DBPath error:nil];
}
}
- (void)readMemoFromDatabase
{
sqlite3 *database;
// 데이터를 담을 오브젝트인 DBData를 초기화 한다.
// 데이터베이스에 처음 엑세스 하는 것이라면 alloc으로 메모리 할당
if(self.isFirstTimeAccess == TRUE)
{
self.DBData = [[NSMutableArray alloc] init];
self.isFirstTimeAccess = FALSE;
}
else // 처음 엑세스하는 것이 아니면 removeAllObject로 DBData를 초기화 한다.
{
[self.DBData removeAllObjects];
}
// 데이터베이스 파일을 open 한다.
if(sqlite3_open([self.DBPath UTF8String], &database) == SQLITE_OK)
{
const char *sqlStatement = "SELECT * FROM tblMemoPad ORDER BY MP_Index DESC";
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)
{
while(sqlite3_step(compiledStatement) == SQLITE_ROW)
{
NSInteger aIndex = sqlite3_column_int(compiledStatement, 0);
NSString *aTitle = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
NSString *aContent = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
NSString *aDate = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];
NSLog(@"%d / %@ / %@ / %@",aIndex, aTitle, aContent, aDate);
MemoData *md = [[MemoData alloc] initWithData:aIndex Title:aTitle Content:aContent Date:aDate];
[self.DBData addObject:md];
}
}
else
{
printf("could not prepare statement : %s\n", sqlite3_errmsg(database));
}
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
- (void)writeMemoToDatabaseWithTitle:(NSString *)inputTitle Content:(NSString *)inputContent
{
sqlite3 *database;
if(sqlite3_open([self.DBPath UTF8String], &database) == SQLITE_OK)
{
const char *sqlStatement = "INSERT INTO tblMemoPad(MP_Title, MP_Content, MP_Date) VALUES(?,?,?)";
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)
{
NSDate *date = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSCalendarUnit unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateComponents *comp = [calendar components:unitFlags fromDate:date];
NSString *yearOfCommonEra = [NSString stringWithFormat:@"%02d", [comp year]];
NSString *monthOfYear = [NSString stringWithFormat:@"%02d", [comp month]];
NSString *dayOfMonth = [NSString stringWithFormat:@"%02d", [comp day]];
NSString *hourOfDay = [NSString stringWithFormat:@"%02d", [comp hour]];
NSString *minuteOfHour = [NSString stringWithFormat:@"%02d", [comp minute]];
NSString *secondOfMinute = [NSString stringWithFormat:@"%02d", [comp second]];
NSString *dateStringConcat = [NSString stringWithFormat:@"%@-%@-%@", yearOfCommonEra, monthOfYear, dayOfMonth];
NSString *timeStringConcat = [NSString stringWithFormat:@"%@:%@:%@", hourOfDay, minuteOfHour, secondOfMinute];
NSString *dateTimeString = [NSString stringWithFormat:@"%@ %@", dateStringConcat, timeStringConcat];
sqlite3_bind_text(compiledStatement, 1, [inputTitle UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(compiledStatement, 2, [inputContent UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(compiledStatement, 3, [dateTimeString UTF8String], -1, SQLITE_TRANSIENT);
if(SQLITE_DONE != sqlite3_step(compiledStatement))
{
NSAssert1(0, @"Error while inserting into tblLocationHistory. '%s'", sqlite3_errmsg(database));
}
sqlite3_reset(compiledStatement);
sqlite3_close(database);
}
else
{
printf("could not prepare statemont : %s\n", sqlite3_errmsg(database));
}
}
else
{
sqlite3_close(database);
NSAssert1(0, @"Error opening database in tblLocationHistory. '%s'", sqlite3_errmsg(database));
}
}
- (void)updateMemoToDatabaseWithTitle:(NSString *)inputTitle Content:(NSString *)inputContent
{
sqlite3 *database;
if(sqlite3_open([self.DBPath UTF8String], &database) == SQLITE_OK)
{
NSString *sqlStatementNS = [[NSString alloc] initWithString:[NSString stringWithFormat:@"UPDATE tblMemoPad SET MP_Title=?, MP_Content=?, MP_Date=? WHERE MP_Index = '%d'", self.currentMemoSQLIndex]];
NSLog(@"SQL = %@", sqlStatementNS);
const char *sqlStatement = [sqlStatementNS UTF8String];
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)
{
NSDate *date = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSCalendarUnit unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateComponents *comp = [calendar components:unitFlags fromDate:date];
NSString *yearOfCommonEra = [NSString stringWithFormat:@"%02d", [comp year]];
NSString *monthOfYear = [NSString stringWithFormat:@"%02d", [comp month]];
NSString *dayOfMonth = [NSString stringWithFormat:@"%02d", [comp day]];
NSString *hourOfDay = [NSString stringWithFormat:@"%02d", [comp hour]];
NSString *minuteOfHour = [NSString stringWithFormat:@"%02d", [comp minute]];
NSString *secondOfMinute = [NSString stringWithFormat:@"%02d", [comp second]];
NSString *dateStringConcat = [NSString stringWithFormat:@"%@-%@-%@", yearOfCommonEra, monthOfYear, dayOfMonth];
NSString *timeStringConcat = [NSString stringWithFormat:@"%@:%@:%@", hourOfDay, minuteOfHour, secondOfMinute];
NSString *dateTimeString = [NSString stringWithFormat:@"%@ %@", dateStringConcat, timeStringConcat];
sqlite3_bind_text(compiledStatement, 1, [inputTitle UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(compiledStatement, 2, [inputContent UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(compiledStatement, 3, [dateTimeString UTF8String], -1, SQLITE_TRANSIENT);
if(SQLITE_DONE != sqlite3_step(compiledStatement))
{
NSAssert1(0, @"Error while inserting into tblLocationHistory. '%s'", sqlite3_errmsg(database));
}
sqlite3_reset(compiledStatement);
sqlite3_close(database);
}
else
{
printf("could not prepare statemont : %s\n", sqlite3_errmsg(database));
}
}
else
{
sqlite3_close(database);
NSAssert1(0, @"Error opening database in tblLocationHistory. '%s'", sqlite3_errmsg(database));
}
}
- (void)deleteMemoFromDatabase
{
sqlite3 *database;
if(sqlite3_open([self.DBPath UTF8String], &database) == SQLITE_OK)
{
NSString *sqlStatementNS = [[NSString alloc] initWithString:[NSString stringWithFormat:@"DELETE FROM tblMemoPad WHERE MP_Index = '%d'", self.currentMemoSQLIndex]];
const char *sqlStatement = [sqlStatementNS UTF8String];
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK)
{
if(SQLITE_DONE != sqlite3_step(compiledStatement))
{
NSAssert1(0, @"Error while inserting into tblLocationHistory. '%s'", sqlite3_errmsg(database));
}
sqlite3_reset(compiledStatement);
}
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);
}
@end

RootViewController.h
#import <UIKit/UIKit.h>
@interface RootViewController : UITableViewController
{
IBOutlet UIBarButtonItem *btnWrite;
}
- (IBAction)btnWriteTouched:(id)sender;
@end
RootViewController.m
#import "RootViewController.h"
#import "MemoPadAppDelegate.h"
#import "MemoData.h"
#import "ContentViewController.h"
#import "MemoWriteViewController.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate readMemoFromDatabase];
self.title = @"MemoPad";
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *) [[UIApplication sharedApplication] delegate];
[appDelegate readMemoFromDatabase];
NSLog(@"reloadData");
[self.tableView reloadData];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *)[[UIApplication sharedApplication] delegate];
int rowCount = [[appDelegate DBData] count];
return rowCount;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *)[[UIApplication sharedApplication] delegate];
MemoData *mData = [[appDelegate DBData] objectAtIndex:indexPath.row];
cell.textLabel.text = mData.mTitle;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
ContentViewController *contentViewController = [[ContentViewController alloc] initWithNibName:@"ContentViewController" bundle:nil];
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *) [[UIApplication sharedApplication] delegate];
[appDelegate setCurrentMemoRowIndex:indexPath.row];
MemoData *tempData = [[appDelegate DBData] objectAtIndex:indexPath.row];
[appDelegate setCurrentMemoSQLIndex:[tempData mIndex]];
[self.navigationController pushViewController:contentViewController animated:YES];
}
- (IBAction)btnWriteTouched:(id)sender
{
MemoWriteViewController *memoWriteViewController = [[MemoWriteViewController alloc] initWithNibName:@"MemoWriteViewController" bundle:nil];
[self.navigationController presentViewController:memoWriteViewController animated:YES completion:nil];
}
@end

ContentViewController.h
#import <UIKit/UIKit.h>
#import "MemoData.h"
@interface ContentViewController : UIViewController<UIAlertViewDelegate>
{
IBOutlet UILabel *labelDate;
IBOutlet UILabel *labelTitle;
IBOutlet UITextView *tvContent;
IBOutlet UIBarButtonItem *btnDelete;
IBOutlet UIBarButtonItem *btnEdit;
IBOutlet UISlider *sliderFontSize;
MemoData *mData;
}
- (IBAction)deleteMemo:(id)sender;
- (IBAction)editMemo:(id)sender;
- (IBAction)changeFontSize:(id)sender;
@property (retain, nonatomic) IBOutlet UILabel *labelDate;
@property (retain, nonatomic) IBOutlet UILabel *labelTitle;
@property (retain, nonatomic) IBOutlet UITextView *tvContent;
@property (retain, nonatomic) IBOutlet UIBarButtonItem *btnDelete;
@property (retain, nonatomic) IBOutlet UIBarButtonItem *btnEdit;
@property (retain, nonatomic) IBOutlet UISlider *sliderFontSize;
@property (retain, nonatomic) MemoData *mData;
@end
ContentViewController.m
#import "ContentViewController.h"
#import "MemoPadAppDelegate.h"
#import "MemoEditViewController.h"
@interface ContentViewController ()
@end
@implementation ContentViewController
@synthesize labelDate;
@synthesize labelTitle;
@synthesize tvContent;
@synthesize mData;
@synthesize btnDelete;
@synthesize btnEdit;
@synthesize sliderFontSize;
- (IBAction)changeFontSize:(id)sender
{
int fontSizeValue = self.sliderFontSize.value;
self.tvContent.font = [UIFont fontWithName:@"Helvetica" size:fontSizeValue];
}
- (IBAction)deleteMemo:(id)sender
{
UIAlertView *alertView;
alertView = [[UIAlertView alloc] initWithTitle:@"MemoPad" message:nil delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alertView setMessage:@"Do you want to delete the memo?"];
[alertView show];
[alertView release];
// MemoEditViewController *memoEditViewController = [[MemoEditViewController alloc] initWithNibName:@"MemoEditViewController" bundle:nil];
// [self.navigationController presentViewController:memoEditViewController animated:YES completion:nil];
// [memoEditViewController release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(buttonIndex == 1)
{
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *) [[UIApplication sharedApplication] delegate];
[appDelegate deleteMemoFromDatabase];
[self.navigationController popViewControllerAnimated:YES];
}
}
- (IBAction)editMemo:(id)sender
{
MemoEditViewController *memoEditViewController = [[MemoEditViewController alloc] initWithNibName:@"MemoEditViewController" bundle:nil];
[self.navigationController presentViewController:memoEditViewController animated:YES completion:nil];
[memoEditViewController release];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *) [[UIApplication sharedApplication] delegate];
self.mData = [[appDelegate DBData] objectAtIndex:[appDelegate currentMemoRowIndex]];
self.labelDate.text = [self.mData mDate];
self.labelTitle.text = [self.mData mTitle];
self.tvContent.text = [self.mData mContent];
self.tvContent.font = [UIFont fontWithName:@"Helvetica" size:12.0];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end

MemoWriteViewController.h
#import <UIKit/UIKit.h>
@interface MemoWriteViewController : UIViewController<UITextViewDelegate>
{
IBOutlet UITextField *tfTitle;
IBOutlet UITextView *tvContent;
IBOutlet UINavigationBar *navigationBar;
IBOutlet UIBarButtonItem *btnSave;
IBOutlet UIBarButtonItem *btnCancel;
}
@property (retain, nonatomic) IBOutlet UITextField *tfTitle;
@property (retain, nonatomic) IBOutlet UITextView *tvContent;
@property (retain, nonatomic) IBOutlet UINavigationBar *navigationBar;
@property (retain, nonatomic) IBOutlet UIBarButtonItem *btnSave;
@property (retain, nonatomic) IBOutlet UIBarButtonItem *btnCancel;
- (IBAction)saveMemo:(id)sender;
- (IBAction)cancelMemo:(id)sender;
@end
MemoWriteViewController.m
#import "MemoWriteViewController.h"
#import "MemoPadAppDelegate.h"
@interface MemoWriteViewController ()
@end
@implementation MemoWriteViewController
@synthesize tfTitle;
@synthesize tvContent;
@synthesize navigationBar;
@synthesize btnCancel;
@synthesize btnSave;
- (IBAction)saveMemo:(id)sender
{
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate writeMemoToDatabaseWithTitle:[self.tfTitle text] Content:[self.tvContent text]];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)cancelMemo:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end

MemoEditViewController.h
#import <UIKit/UIKit.h>
#import "MemoData.h"
@interface MemoEditViewController : UIViewController
{
IBOutlet UITextField *tfTitle;
IBOutlet UITextView *tvContent;
IBOutlet UIBarButtonItem *btnSave;
IBOutlet UIBarButtonItem *btnCancel;
MemoData *mData;
}
@property(retain, nonatomic) IBOutlet UITextField *tfTitle;
@property(retain, nonatomic) IBOutlet UITextView *tvContent;
@property(retain, nonatomic) MemoData *mData;
- (IBAction)saveMemo:(id)sender;
- (IBAction)cancelMemo:(id)sender;
@end
MemoEditViewController.m
#import "MemoEditViewController.h"
#import "MemoPadAppDelegate.h"
@interface MemoEditViewController ()
@end
@implementation MemoEditViewController
@synthesize tfTitle;
@synthesize tvContent;
@synthesize mData;
- (IBAction)saveMemo:(id)sender
{
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *) [[UIApplication sharedApplication] delegate];
[appDelegate updateMemoToDatabaseWithTitle:[self.tfTitle text] Content:[self.tvContent text]];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)cancelMemo:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewDidAppear:(BOOL)animated
{
[self.tfTitle becomeFirstResponder];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
MemoPadAppDelegate *appDelegate = (MemoPadAppDelegate *) [[UIApplication sharedApplication] delegate];
self.mData = [[appDelegate DBData] objectAtIndex:[appDelegate currentMemoRowIndex]];
self.tfTitle.text = [self.mData mTitle];
self.tvContent.text = [self.mData mContent];
self.tvContent.font = [UIFont fontWithName:@"Helvetica" size:12.0];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end