这是我尝试在 IOS 中构建的第一个应用程序,但我遇到了一些问题。虽然我在这里阅读了类似的主题,但我无法找到答案。
好吧,这是我的课程:
Homeview.h
@interface HomeView : UIViewController{
NSString *parsed_date;
}
@property (nonatomic,retain) NSString *parsed_date;
@end
Homeview.m
@synthesize parsed_date;
parsed_date=[res objectForKey:@"date"];
我希望在我的主页视图中正常打印的日期在其他视图中传递。
这是我的另一堂课:
其他类.h
#import <UIKit/UIKit.h>
@interface OtherView : UIViewController{
NSString* tracks_date;
}
@property (nonatomic,retain) NSString* tracks_date;
@end
其他类.m
#import "OtherView.h"
#import "HomeView.h"
@interface OtherView ()
@end
@implementation OtherView
@synthesize tracks_date;
- (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.
//preview value of other class
NSLog(@"Dated previed in OtherView: %@", HomeView.parsed_date); //HERE IS THE ERROR
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
这是我的错误:
property parsed_date not found on object of type "HomeView"