开发者

touch events in UIScrollview

开发者 https://www.devze.com 2023-02-14 22:32 出处:网络
I\'m new to iPhone development. I have so many UIImageViews added as subview at runtime to the self.view.

I'm new to iPhone development. I have so many UIImageViews added as subview at runtime to the self.view.

My current architecture is:

  1. Inside UIView there is a UIScrollView and inside UIScrollView there is another UIView which is attached to a UIView sub class named SeatingPlan.
  2. SeatingPlan only draws the grid on the screen.
  3. The UIImageViews are drawn on the screen the by UIViewController sub class named SeatingPlanViewContoller. The UIImageViews 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号