- (void)drawRect:(CGRect)rect { //image url UIImage *myImage = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: @"http://sammlungen-archive.zhdk.ch/media/thumbnails/19-0279.jpg"]]]; for(int rowIndex = 0; rowIndex < 4; rowIndex++) { for(int colIndex = 0; colIndex < 6; colIndex++) { NSLog(@"currentColumn%",colIndex); UIImageView *myImageView = [[UIImageView alloc] initWithImage:myImage]; CGRect frame = myImageView.frame; frame.origin.x = frame.size.width * colIndex; frame.origin.y = frame.size.height * rowIndex; myImageView.frame = frame; [self addSubview:myImageView]; [myImageView release]; } } }ref: http://www.iphonedevsdk.com/forum/iphone-sdk-development/12858-generate-grid-images.html
Posts Tagged ‘Image’
Basic ImageGrid
Freitag, Oktober 8th, 2010
Simple Example Grid:
1. Create ViewBasedApplication
2. Add -> NewFile -> Cocoa Touch Class -> Objective-C-Class(UIView) -> ExampleGrid
3. Open the already existing ExampleGridViewController.xib
4. Click on the View(In the list below Files'Owner and FirstResponder) -> Change the ClassIdentity to your Created ExampleGrid -Class
5. Add the following example-function to the ExampleGrid-Class: