ビュー間でカスタム クラスを渡そうとしています。そのクラスのプロパティを設定しましたが、プロパティにアクセスすると、属性は常に null を返します。
firstview.m:
- (void)initNextEventView{
NSDate *eventDate = [eventDatePicker date];
NSString *eventName = eventNameTextfield.text;
LocateEventViewController *locView = [[LocateEventViewController alloc]init];
locView.eventDTO.name = eventName;
locView.eventDTO.date = eventDate;
[[self navigationController] pushViewController:locView animated:YES];
}
LocateEventVC.h (2. ビュー):
@interface LocateEventViewController : UIViewController<MKMapViewDelegate, UISearchBarDelegate, BSForwardGeocoderDelegate>
@property (strong, nonatomic) IBOutlet UIImageView *imageBackground;
@property (strong, nonatomic) EventDTO *eventDTO;
そのため、 eventDTOの属性をログに記録すると、null が返されます。
どんな助けでも素晴らしいでしょう
編集1(2.ビュー): それが私が記録する方法です:
NSLog(@"name on 2. view: %@", eventDTO.name);
self.eventDTO.place = tmpEventPlace;
// init friends view!
//passing to next view
EventMembersViewController *members = [[EventMembersViewController alloc]init];
members.eventDTO = self.eventDTO;
EventDTO.h
@interface EventDTO : NSObject
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) UserDTO * creatorIsAppUser;
@property (nonatomic, retain) ContactDTO * creatorIsNotAppUser;
@property (nonatomic, retain) NSString * description;
@property (nonatomic, retain) NSDate * date;
@property (nonatomic, readwrite) NSInteger *eventID;
@property (nonatomic, retain) CustomPlacemark * place;
@property (nonatomic, retain) NSMutableArray *invitedMembers;
@property (nonatomic, retain) NSMutableArray *acceptedMembers;
- (NSNumber*)getLatidude;
- (NSNumber*)getLongitude;
EventDTO.m
@synthesize place, date, eventID, name, acceptedMembers, description, invitedMembers;
- (NSNumber*)getLatidude{
return [NSNumber numberWithDouble:place.coordinate.latitude];
}
- (NSNumber*)getLongitude{
return [NSNumber numberWithDouble:place.coordinate.longitude];
}