The cat learns the Micro-blog project of iOS (13) send micro-blog to call the picture inside the camera and call the camera

Source: Internet
Author: User
<span id="Label3"></p><p><p>Cat share, must Boutique</p></p><p><p>Original articles, Welcome Reprint. Reprint please specify: Sanayu's blog<br>Address: http://blog.csdn.net/u013357243</p></p>One: effect<p><p></p></p>Two: Code<p><p>The camera section is much simpler and a few lines of code are called, but if you want to implement more rich functionality, you need to write it yourself. With assetslibrary.framework, You can use this framework to get all the photo albums on your phone and write a picture selector controller.</p></p><pre class="prettyprint"><code class=" hljs fsharp">- (<span class="hljs-keyword"><span class="hljs-keyword">void</span></span>) Opencamera{[self openimagepickercontroller:uiimagepickercontrollersourcetypecamera];} - (<span class="hljs-keyword"><span class="hljs-keyword">void</span></span>) openalbum{<span class="hljs-comment"><span class="hljs-comment">//if you want to write a picture selection controller, you have to use assetslibrary.framework, Use this framework to get all the album pictures on the phone</span></span> <span class="hljs-comment"><span class="hljs-comment">//uiimagepickercontrollersourcetypephotolibrary > Uiimagepickercontrollersourcetypesavedphotosalbum</span></span>[self openimagepickercontroller:uiimagepickercontrollersourcetypephotolibrary];} - (<span class="hljs-keyword"><span class="hljs-keyword">void</span></span>) Openimagepickercontroller: (uiimagepickercontrollersourcetype)<span class="hljs-class"><span class="hljs-class"><span class="hljs-keyword">type</span></span></span>{<span class="hljs-keyword"><span class="hljs-keyword">if</span></span>(! [uiimagepickercontroller issourcetypeavailable:<span class="hljs-class"><span class="hljs-class"> <span class="hljs-keyword">type</span>]) <span class="hljs-title">return</span>;</span></span>Uiimagepickercontroller *IPC = [[uiimagepickercontroller alloc] init]; Ipc.sourcetype =<span class="hljs-class"><span class="hljs-class"> <span class="hljs-keyword">type</span>;</span></span>Ipc.<span class="hljs-keyword"><span class="hljs-keyword">Delegate</span></span>= self; [self PRESENTVIEWCONTROLLER:IPC Animated:yes completion:nil];}</code></pre><p><p>Implementing a Proxy</p></p><pre class="prettyprint"><pre class="prettyprint"><code class=" hljs java">#pragma mark - UIImagePickerControllerDelegate<span class="hljs-javadoc">/** * 从UIImagePickerController选择完图片后就调用(拍照完毕或者选择相册图片完毕) */</span>- (<span class="hljs-keyword">void</span>)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ [picker dismissViewControllerAnimated:YES completion:nil]; <span class="hljs-comment">// info中就包含了选择的图片</span> UIImage *image = info[UIImagePickerControllerOriginalImage]; <span class="hljs-comment">// 添加图片到photosView中</span> [self.photosView addPhoto:image];<span class="hljs-comment">// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{</span><span class="hljs-comment">// self.picking = NO;</span><span class="hljs-comment">// });</span>}</code></pre></pre> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p> Cat learns the Micro-blogging project of iOS (13) send a Weibo call to a picture inside the camera and call the camera </p> </p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.