Ios 将数据从带有pagecontroller的uiscrollview传递到另一个viewcontroller

Ios 将数据从带有pagecontroller的uiscrollview传递到另一个viewcontroller,ios,uiview,uiscrollview,uiscrollviewdelegate,Ios,Uiview,Uiscrollview,Uiscrollviewdelegate,我有一个图像的滚动视图,我会想标签他们,并将推到另一个视图 在图像上单击tab键后,整个视图应推送到另一个视图。 这是myScrollView.h,如下所示 @interface PeekPagedScrollViewController : UIViewController <UIScrollViewDelegate> @property (nonatomic, strong) IBOutlet UIScrollView *scrollView; @property (nonat

我有一个图像的滚动视图,我会想标签他们,并将推到另一个视图

在图像上单击tab键后,整个视图应推送到另一个视图。 这是my
ScrollView.h
,如下所示

@interface PeekPagedScrollViewController : UIViewController <UIScrollViewDelegate>

@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;
@property (nonatomic, strong) IBOutlet UIPageControl *pageControl;

@end
因此,当用户触摸照片时,我需要转到另一个detailViewController;例如,如果选择了照片1,此照片将在另一个viewcontroller上放大
因此,如果有人知道解决方案或合适的教程,最好使用
UITableView
并使用延迟加载将所有图像加载到
UITableViewCell
,当您选择任何图像时,
didSelectRowAtIndexPath
将为您提供所选图像的索引,这样您就可以导航并将数据从一个viewController传递到下一个viewController


请参阅以下示例代码,以便更好地使用UITableview或GMGridView

[theApp.fullViewModeObject.statusDicts addObjectsFromArray:statusDicts];
[self.navigationController pushViewController:theApp.fullViewModeObject animated:YES];
app.fullviewmode对象是fullviewmode类对象
[theApp.fullViewModeObject.statusDicts]是用于加载图像详细信息的数组

UIScrollView
添加一个
UITappestureRecognitor
,自己设置
委托
,然后此方法应为您提供点击图像的索引:

- (void)singleTapGestureCaptured:(UITapGestureRecognizer *)gesture{

    CGPoint touchPoint = [gesture locationInView:<yourScrollView>];

    NSUInteger touchedPage = floorf(touchPoint.x / <yourScrollView>.frame.size.width);
    if ([<arrayOfImages> count>] > 1) {

        touchedPage = touchedPage % ([<arrayOfImages> count] - 1);
    }

    NSLog(@"Touched page: %d", touchedPage);

    //Use touchedPage and push the next view controller here

}

所以你想让我们完整地写逻辑。相反,你应该显示一些代码,你已经Struck提供一些代码,它不清楚你在哪里卡住了,请指定?请参阅下面的代码我张贴一些代码上面;因此,请帮助我,或者如果你知道一个合适的教程,你可以检查张贴的代码;你能告诉我更多的细节吗?你知道教程解释我已经更新了我的答案。请检查。你能告诉我如何导入UITapGestureRecognitor;或者我可以选择哪个框架import@MohamedReda编辑了我的答案,无需添加框架非常感谢您我的问题已经解决请允许我再次坚持如何将图像传递到第二个视图我尝试将此代码放到ViewDiLoad
[imageView setImage:chosenImage]
self.selectedImage.image=[UIImage ImageName:self.imageView]但它不起作用;能否帮助我为DetailViewController.h文件定义名为selectedImage的属性(UIImage或UIImageView)。然后使用我提供的代码设置所选图像,如detailViewController.SelecteImage=[objectAtIndex:touchedPage];并按下新的视图控制器。现在,您可以在DetailViewController.m文件中使用_selectedImage。
- (void)singleTapGestureCaptured:(UITapGestureRecognizer *)gesture{

    CGPoint touchPoint = [gesture locationInView:<yourScrollView>];

    NSUInteger touchedPage = floorf(touchPoint.x / <yourScrollView>.frame.size.width);
    if ([<arrayOfImages> count>] > 1) {

        touchedPage = touchedPage % ([<arrayOfImages> count] - 1);
    }

    NSLog(@"Touched page: %d", touchedPage);

    //Use touchedPage and push the next view controller here

}
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)];
[<yourScrollView> addGestureRecognizer:singleTap];