视图1.h
#import “view2.h"
@interface ViewController : UIViewController
{
int count;
}
@property (nonatomic, assign) int count;
在 view1.m
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqualToString:@"rating"])
{
NSLog(@"identifier: help %@ \n",segue.identifier);
view2 *vc = [segue destinationViewController];
vc.imageNumber = &(count);
}
}
在 view2.h
#import “view1.h"
@interface view2 : UIViewController
@property (nonatomic) int *imageNumber;
在 view2.m
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"imagenumber %@\n",imageNumber);
}
这里有什么问题?理想情况下,我希望能够双向发送信息......但我只是想弄清楚单向传输有什么问题。谢谢。