在UIScrollview中触摸事件

时间:2011-03-06 14:48:31

标签: iphone ios uiscrollview uiimageview touch

我是iPhone开发的新手。我在运行时向UIImageView添加了很多self.view个子视图。

我目前的架构是:

  1. UIView内部有一个UIScrollView,在UIScrollView内,还有一个UIView附加到名为UIView的{​​{1}}子类。
  2. SeatingPlan仅在屏幕上绘制网格。
  3. SeatingPlan在屏幕上由名为UIImageView的{​​{1}}子类绘制。 UIViewController被添加为子视图。
  4. SeatingPlanViewContoller保存在UIImageView中。

    .h文件:

    UIImageView

    .m文件:

    NSMutableArray

    我想在屏幕上移动@interface SeatingPlanViewController : UIViewController <UIScrollViewDelegate, UIAlertViewDelegate>{ IBOutlet UIScrollView * scrollView; SeatingPlan * planView; CGPoint origin; NSMutableArray * arrayOfImages; } 。我更喜欢一些示例代码。

    我应该在哪里放置触摸处理代码?在视图控制器子类中还是在- (void)viewDidLoad { [super viewDidLoad]; [self.navigationItem setTitle:@"Seating Planner"]; UIBarButtonItem *mySave = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(Save)]; self.navigationItem.rightBarButtonItem = mySave; [mySave release]; segmentController.selectedSegmentIndex = UISegmentedControlNoSegment; segmentController.momentary = YES; scrollView.contentSize=CGSizeMake(1280.0,960.0); [scrollView setBackgroundColor:[UIColor whiteColor]]; scrollView.indicatorStyle = UIScrollViewIndicatorStyleBlack; [planView addSubview:scrollView]; [self.view addSubview:planView]; } 子类中?

0 个答案:

没有答案