Step 1 : In .h file add ui-image-view object as ==>> IBOutlet UIImageView *imgView;
imgView object use to set image to zoom in /out
imgView object use to set image to zoom in /out
- (IBAction)btnSharePressed:(id)sender { //filePath must NSURL object and looking like this => file:///Users/simon/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/A5321493-318A-4A3B-8B37-E56B8B4405FC/AirDropDemo.app/ios-game-kit-sample.pdf NSString *filePath = [NSString stringWithFormat:@"file://%@",[self getFilePath:@"ios-game-kit-sample.pdf"]]; UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[filePath] applicationActivities:nil]; [self presentViewController:activityViewController animated:YES completion:nil]; }
[self.navigationItem setPrompt:@"Add photos with faces to Googlyify them!"];
- (void)showToast { double delayInSeconds = 1.0; dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); // 1 dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ // 2 [self.navigationItem setPrompt:@"Add photos with faces to Googlyify them!"]; }); }
NSArray *arrayName = @[@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi",@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi",@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi",@"Gaurav", @"Kunal", @"Madhvi",@"Ashu Sir",@"Gupta ji",@"Rajneesh",@"Vikram",@"Sakshi"]; NSMutableString *stringName = [NSMutableString new]; for (NSString *name in arrayName) { [stringName appendFormat:@"%@, ",name]; } NSMutableAttributedString *strAtributed =[[NSMutableAttributedString alloc] initWithString:stringName]; NSUInteger startName = 0, lengthName = 0; BOOL toogle = true; for (NSString *name in arrayName) { lengthName = name.length; NSRange range = NSMakeRange(startName, lengthName); startName += lengthName + 2; if (toogle) { [strAtributed addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:range]; } else { [strAtributed addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:range]; } toogle = !toogle; } [txtView setAttributedText:strAtributed]; [txtView setFont:[UIFont systemFontOfSize:20]];
You can use lock (such as those enumerated in the Synchronization section of the Threading Programming Guide) or you can use a dedicated serial queue. For example, create a queue:
Instantiate it:
And whenever you want to interact with the database, you can do
If you want to simplify your life, the FMDB library has a FMDatabaseQueue object that does much of this for you (as well as greatly simplifying your database interaction in general).for more detail read http://stackoverflow.com/questions/20029782/how-to-handle-multiple-thread-access-the-sqlite3-with-out-dblocked-error |
INSERT INTO tbl_img_upload_queue11 (galleryID, galleryURL,imgUniqueName, imgTime, imgLat, imgLong, uploadStatus) SELECT id, galleryURL, imgUniqueName, imgTime, imgLat, imgLong, "0" as uploadStatus FROM tbl_gallery_img as tb Where id not in (select galleryid from tbl_img_upload_queue11 where tb.id<>id) and id in(1,2,3,4)
$message, 'sound' => 'default' ); // other info which is send to push notification $body['others'] = $otherMsg; // finally convert whole message to json and this payload variable send to apple $payload = json_encode($body); echo $payload." "; try { $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', dirname(__FILE__).'/'.$selectPEM); stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase); $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) .pack('n', strlen($payload)) . $payload; $result = fwrite($fp, $msg, strlen($msg)); fclose($fp); } catch(Exception $e) { continue; } } ?>
ALAssetManager
image loading, I want to add it to code that is already nicely multi-threaded, and designed to support other methods of loading images (that use blocking reads, rather than the newer completion block design). I’d rather not totally mess up the flow of my logic, and since it’s already threaded, it’s perfectly fine to just block and wait for the asset manager to return.$sudo chmod 0700 ec2-keypair.pem $ssh -i ec2-keypair.pem ec2-user@ec2-elastic-ip
- (UIImage *) blurImage:(UIImage *) image { /* What we need: CIContext CIImage CIImage We create a CIContext, a CIImage and a CIFilter. Then we pass the CIImage to the CIFilter. We grap the filtered Image from the outputImage-property of the CIFilter and render that with the context to a CGImageRef Finally, we create a UIImage from the CGImageRef and return it */ //We create the context first to get that out of the way //TODO: 1. Create a CIContext with options nil (a default context) CIContext * context = [CIContext contextWithOptions:nil]; //Now we create a CIImage that can be filtered with a CIFilter //TODO: 2. Create a CIImage from the UIImage* image (use -initWithImage) CIImage * ciImage = [[CIImage alloc] initWithImage:image]; //We create our Filter now and set it up //TODO: 3. Create a blur-filter. It's name is @"CIGaussianBlur" CIFilter * blurFilter = [CIFilter filterWithName:@"CIGaussianBlur"]; //TODO: 4. Set the CIImage form Step 2 as the inputImage on the blur-filter //HINT: use - setValue:(your blur-filter) froKey:(the input-image-key) [blurFilter setValue:ciImage forKey:kCIInputImageKey]; //Now we render the CIImage with our blur-filter //TODO: 5. Create a CGImageRef with the context from Step 1. //HINT: - createCGImage: fromRect: //HINT: use the outputImage-property of the blur-filter //HINT: the outputImage knows it's size, because it was created from another image (the UIImage) //you can get the required rect from the -extent method of your outputImage CGImageRef ref = [context createCGImage:blurFilter.outputImage fromRect:[blurFilter.outputImage extent]]; //Finaly, we create a new UIImage from the CGImageRef //TODO: 6. create a UIImage from the CGImageRef. //HINT: There's a convenience-static-method in the UIImage for that: +imageWithCGImage: return [UIImage imageWithCGImage:ref]; }