I'm new to iPhone development. I have so many UIImageView
s added as subview at runtime to the self.view
.
My current architecture is:
- Inside
UIView
there is aUIScrollView
and insideUIScrollView
there is anotherUIView
which is attached to aUIView
sub class namedSeatingPlan
. SeatingPlan
only draws the grid on the screen.- The
UIImageView
s are drawn on the screen the byUIViewController
sub class namedSeatingPlanViewContoller
. TheUIImageView
s are added as the subviews.
The UIImageView
s 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 UIImageView
s 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?
精彩评论