テキストと画像は正常に機能するように設定されていましたが、UI の日付と整数値を設定する方法を教えてください。sqlite iPhoneでUIの日付と整数値を設定するには? これは私のコメント class.h です
@interface Comments : NSObject
{
NSInteger iD;
UIImage *photo;
NSString *name;
NSString *descrp;
NSDate *date;
NSString *msg;
NSInteger noofcomm;
NSInteger nooflikes;
}
@property(nonatomic,assign)NSInteger iD;
@property(nonatomic,retain)UIImage *photo;
@property(nonatomic,retain)NSString *name;
@property(nonatomic,retain)NSString *descrp;
@property(nonatomic,strong)NSDate *date;
@property(nonatomic,retain)NSString *msg;
@property(nonatomic,assign)NSInteger noofcomm;
@property(nonatomic,assign)NSInteger nooflikes;
@end
そして、これは私の RootViewController.h です
@interface RootViewController : UIViewController
{
NSMutableArray *list;
}
@property(nonatomic,retain)NSMutableArray *list;
@property(weak,nonatomic)IBOutlet UIImageView *image2;
@property(weak,nonatomic)IBOutlet UILabel *name2;
@property(weak,nonatomic)IBOutlet UILabel *descrp2;
@property(weak,nonatomic)IBOutlet UILabel *date2;
@property(weak,nonatomic)IBOutlet UITextView *msg2;
@property(weak,nonatomic)IBOutlet UILabel *comments2;
@property(weak,nonatomic)IBOutlet UILabel *likes2;
@end
これは私の RootViewController.m です
#import "RootViewController.h"
#import "Comments.h"
#import "DBClass.h"
@interface RootViewController ()
@end
@implementation RootViewController
@synthesize list;
@synthesize image2;
@synthesize name2;
@synthesize descrp2;
@synthesize msg2;
@synthesize date2;
@synthesize comments2;
@synthesize likes2;
- (void)viewDidLoad
{
DBClass * mywines =[[DBClass alloc] init];
self.list = [mywines getMyComments];
[self.image2 setImage:((Comments *) [self.list objectAtIndex:0]).photo];
[self.name2 setText:((Comments *) [self.list objectAtIndex:0]).name];
[self.descrp2 setText:((Comments *) [self.list objectAtIndex:0]).descrp];
//[self.date2 setDate:((Comments *) [self.list objectAtIndex:0]).date];
[self.msg2 setText:((Comments *) [self.list objectAtIndex:0]).msg];
// [self.comments2 setText:((Comments *) [self.list objectAtIndex:0]).noofcomm];
// [self.likes2 setText:((Comments *) [self.list objectAtIndex:0]).nooflikes];
[super viewDidLoad];
}
- (void)viewDidUnload
{
[self setImage2:nil];
[self setName2:nil];
[self setMsg2:nil];
[self setDescrp2:nil];
[self setComments2:nil];
[self setLikes2:nil];
[self setDate2:nil];
[super viewDidUnload];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end