Note that there are some explanatory texts on larger screens.

plurals
  1. POPicture taken form iphone real device that images displaying in thumbnail is taking too long in iphone
    primarykey
    data
    text
    <p>I am new to i phone programming.I have store images in array then using below code i am displaying images in thumbnail its working very fast.If same think i have store images in database and retrieving images and storing in array then using below code i am displaying images in thumbnail its taking too long to displaying thumbnail images.</p> <pre><code> arrayz = [NSMutableArray arrayWithObjects:[UIImage imageNamed:@"image3.jpg"], [UIImage imageNamed:@"image4.jpg"], [UIImage imageNamed:@"image5.jpg"], [UIImage imageNamed:@"image3.jpg"], [UIImage imageNamed:@"image5.jpg"], [UIImage imageNamed:@"image4.jpg"], [UIImage imageNamed:@"image2.jpg"], [UIImage imageNamed:@"image3.jpg"], [UIImage imageNamed:@"image2.jpg"], [UIImage imageNamed:@"image5.jpg"], nil]; NSLog(@"%i" , [arrayz count]); NSLog(@"%@",arrayz); myScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320.0, 840.0)]; myScrollView.delegate = self; myScrollView.contentSize = CGSizeMake(320.0, 840.0); myScrollView.backgroundColor = [UIColor whiteColor]; [self.view addSubview:myScrollView]; float horizontal = 8.0; float vertical = 8.0; for(int i=0; i&lt;[arrayz count]; i++) { if((i%4) == 0 &amp;&amp; i!=0) { horizontal = 8.0; vertical = vertical + 70.0 + 8.0; } buttonImage1 = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonImage1 setFrame:CGRectMake(horizontal, vertical, 70.0, 70.0)]; [buttonImage1 setTag:i]; [buttonImage1 setImage:[arrayz objectAtIndex:i] forState:UIControlStateNormal]; [buttonImage1 addTarget:self action:@selector(buttonImagePressed:) forControlEvents:UIControlEventTouchUpInside]; [buttonImage1 setImage:[UIImage imageNamed:@"Overlay.png"] forState:UIControlStateSelected]; buttonImage = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonImage setFrame:CGRectMake(horizontal, vertical, 70.0, 70.0)]; [buttonImage setTag:i]; [buttonImage setImage:[arrayz objectAtIndex:i] forState:UIControlStateNormal]; [buttonImage addTarget:self action:@selector(buttonImagePressed:) forControlEvents:UIControlEventTouchUpInside]; [buttonImage setImage:[UIImage imageNamed:@"Overlay.png"] forState:UIControlStateSelected]; // UIImageView *imageee=[[UIImageView alloc]initWithFrame:CGRectMake(10,10, 80,80)]; // [buttonImage setImage:[UIImage imageNamed:@"check.jpg"]]; // [buttonImage setImage:imageee forState:UIControlStateSelected]; // [buttonImage setImage:button.currentImage forState:UIControlStateNormal]; [myScrollView addSubview:buttonImage1]; [myScrollView addSubview:buttonImage]; horizontal = horizontal + 70.0 + 8.0; [myScrollView setContentSize:CGSizeMake(320.0, vertical + 78.0)]; } // Do any additional setup after loading the view, typically from a nib. self.navigationItem.leftBarButtonItem = self.editButtonItem; // UIBarButtonItem *done =[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonItemStyleDone target:self action:nil]; UIBarButtonItem *done = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(insertNewObject:)]; self.navigationItem.rightBarButtonItem = done; </code></pre> <p>below code using database i am storing images in array then i am displaying images in thumbnail.its taking too long to display the images in thumbnail.</p> <pre><code> NSString *docsDir; NSArray *dirPaths; // Get the documents directory dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); docsDir = [dirPaths objectAtIndex:0]; array=[[NSMutableArray alloc]init]; array1=[[NSMutableArray alloc]init]; // array2=[[NSMutableArray alloc]init]; // Build the path to the database file databasePath = [docsDir stringByAppendingPathComponent: @"Taukydataaa.db"]; // NSLog(@"%@",databasePath); NSFileManager *fn=[NSFileManager defaultManager]; NSError *error; BOOL success=[fn fileExistsAtPath:databasePath]; if(!success) { NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Taukydataaa.db"]; success = [fn copyItemAtPath:defaultDBPath toPath:databasePath error:&amp;error]; } const char *dbpath = [databasePath UTF8String]; sqlite3_stmt *statement; if (sqlite3_open(dbpath, &amp;contactDB) == SQLITE_OK) { NSString *querySQL = [NSString stringWithFormat: @"select * from path "]; const char *query_stmt = [querySQL UTF8String]; if (sqlite3_prepare_v2(contactDB, query_stmt, -1, &amp;statement, NULL) == SQLITE_OK) { while(sqlite3_step(statement) == SQLITE_ROW) { NSString* email_idField = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,1)]; // NSLog(@"%@",email_idField); NSString* email_idField1 = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,0)]; // NSLog(@"%@",email_idField1); // NSString *email_idField2 = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,2)]; NSLog(@"ASlma"); NSLog(@"%@",email_idField1); [array addObject:email_idField]; [array1 addObject:email_idField1]; NSLog(@"%@",array); NSLog(@"%@",array1); // [array1 addObject:email_idField1]; // [array2 addObject:email_idField2]; } sqlite3_finalize(statement); } sqlite3_close(contactDB); } blaukypath =[[NSMutableArray alloc]init]; for (NSString* path in array) { [blaukypath addObject:[UIImage imageWithContentsOfFile:path]]; NSLog(@"%@",path); } NSLog(@"%@",blaukypath1); myScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320.0, 840.0)]; myScrollView.delegate = self; myScrollView.contentSize = CGSizeMake(320.0, 840.0); myScrollView.backgroundColor = [UIColor whiteColor]; [self.view addSubview:myScrollView]; float horizontal = 8.0; float vertical = 8.0; for(int i=0; i&lt;[blaukypath count]; i++) { if((i%4) == 0 &amp;&amp; i!=0) { horizontal = 8.0; vertical = vertical + 70.0 + 8.0; } buttonImage1 = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonImage1 setFrame:CGRectMake(horizontal, vertical, 70.0, 70.0)]; [buttonImage1 setTag:i]; [buttonImage1 setImage:[blaukypath objectAtIndex:i] forState:UIControlStateNormal]; [buttonImage1 addTarget:self action:@selector(buttonImagePressed:) forControlEvents:UIControlEventTouchUpInside]; [buttonImage1 setImage:[UIImage imageNamed:@"Overlay.png"] forState:UIControlStateSelected]; buttonImage = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonImage setFrame:CGRectMake(horizontal, vertical, 70.0, 70.0)]; [buttonImage setTag:i]; [buttonImage setImage:[blaukypath objectAtIndex:i] forState:UIControlStateNormal]; [buttonImage addTarget:self action:@selector(buttonImagePressed:) forControlEvents:UIControlEventTouchUpInside]; [buttonImage setImage:[UIImage imageNamed:@"Overlay.png"] forState:UIControlStateSelected]; // UIImageView *imageee=[[UIImageView alloc]initWithFrame:CGRectMake(10,10, 80,80)]; // [buttonImage setImage:[UIImage imageNamed:@"check.jpg"]]; // [buttonImage setImage:imageee forState:UIControlStateSelected]; // [buttonImage setImage:button.currentImage forState:UIControlStateNormal]; [myScrollView addSubview:buttonImage1]; [myScrollView addSubview:buttonImage]; horizontal = horizontal + 70.0 + 8.0; [myScrollView setContentSize:CGSizeMake(320.0, vertical + 78.0)]; } </code></pre> <p>I think problem is not with database.What main think is if i take images from i phone real device that images taking too long to display in thumbnail.If i take some images and store in array that images displaying in thumbnail its working very fast.. Can any body tell me How to slove this. Thanks Aslam</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload