trying to add database to working table view app with no luck
I have a working app which is a table view app开发者_运维问答 and I'm trying to store my table view to a database. I've searched google but I couldn't find anything helpful! All the tutorials I've found are tutorials for building apps from scratch. I just want to update mine! So here is my basic class:
#import <Foundation/Foundation.h>
@interface Movie : NSObject
{
NSString *_title;
NSString *_gender;
NSString *_location;
NSNumber *_publicationYear;
}
@property (nonatomic, retain) NSString *location;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *gender;
@property (nonatomic, retain) NSNumber *publicationYear;
+ (id)movieWithTitle:(NSString *)title
gender:(NSString *)gender
year:(NSUInteger)year
location:(NSString *)location;
- (id)initWithTitle:(NSString *)title
gender:(NSString *)gender
year:(NSUInteger)year
location:(NSString *)location;
@end
What I want to do is create a database and store "title", "gender", "year" and "location" and then make them appear in my table view.
Any help will be great. Thanks in advance. If there is anything else you want me to post for making it easier to answer please notify me.
just fetch allData from sqlite & assign them to your Movie object. make aray of Movie object & use it in to your tableview :)
See this fantastic tutorial from Ray Wenderlich which'll teach you everything you need to know about adding SQLite to your app.
精彩评论