touch events in UIScrollview
I'm new to iPhone development. I have so many UIImageViews added as subview at runtime to the self.view.
My current architecture is:
- Inside
UIViewthere is aUIScrollViewand insideUIScrollViewthere is anotherUIViewwhich is attached to aUIViewsub class namedSeatingPlan. SeatingPlanonly draws the grid on the screen.- The
UIImageViews are drawn on the screen the byUIViewControllersub class namedSeatingPlanViewContoller. TheUIImageViews are added as the subviews.
The UIImageViews are saved in an NSMutableArray.
The .h file:
@interface SeatingPlanViewController : UIViewController <UIScrollViewDelegate, UIAlertViewDelegate>{
IBOutlet UIScrollView * scrollView;
SeatingPlan * planView;
CGPoint origin;
NSMutableArray * arrayOfImages;
}
The .m file:
- (void)viewDidLoad {
[super viewDidLoad];
[self.navigationItem setTitle:@"Seating Pla开发者_StackOverflow中文版nner"];
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];
}
I want to move the UIImageViews on the screen. I would prefer some sample code.
Where should I put my touch handling code? In the view controller subclass or in the UIView subclass?
加载中,请稍侯......
精彩评论