我的应用程序有一个非常奇怪的问题。我在我的应用程序中使用 AFNetworking 框架。我正在加载一些带有图像的提要,然后单击操作打开带有详细描述和大图像的新 View 。所以我将 IdPhoto 发送到描述 View ,但是当 IdPhoto 大于 12 prepareForSegue 时,发送内存中的地址而不是 IdPhoto 值。
-(void)didSelectPhoto:(PhotoView*)sender {
//photo selected - show it full screen
[self performSegueWithIdentifier:@"ShowPhoto" sender:[NSNumber numberWithInt:sender.tag]];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([@"ShowPhoto" compare: segue.identifier]==NSOrderedSame) {
DescrController* streamPhotoScreen = segue.destinationViewController;
streamPhotoScreen.IdPhoto = sender;
}
}
部分PhotoView代码
-(id)initWithIndex:(int)i andData:(NSDictionary*)data {
self = [super init];
if (self !=nil) {
//initialize
self.tag = [[data objectForKey:@"IdPhoto"] intValue];
所以我不明白为什么当值超过 12 时它不将 IdPhoto 发送到另一个 View
最佳答案
- 您是否将属性 streamPhotoScreen.IdPhoto 设置为 STRONG ?并确保这不是 IBOutlet。
- 如果 1. 没问题,你能不能在你的 prepareForSegue: 中放置一个断点来检查 sender 是否真的是你正在等待的......
关于ios - prepareForSegue 没有发送正确的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22506537/