IOS: automatically read the use of Image plugin Ksimagenamed-xcode-master

Source: Internet
Author: User
<span id="Label3"></p><p class="two"><p class="two"><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">GitHub link:<cite>Https://github.com/ksuther/KSImageNamed-Xcode</cite></span></p></p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;"><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;"> </span></span><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;"><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">Ksimagenamed-xcode is a Xcode plugin that helps developers automatically fill in the image name in Xcode. Support Nsimage and Uiimage. With preview Feature. </span></span><br><br><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;"><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">website: http://ksuther.com/2013/01/22/ksimagenamed-xcode-autocomplete-for-imagenamed/</span></span><p><p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">When we use imagename this method, we can see the picture of the hint, and when we write a uiimage extension, we need to use the resource picture, often there is no picture resource hints, such as the following method,</span></p></p><pre><span style="color: #0000ff;"><span style="color: #0000ff;">#define</span></span>IOS7 ([[uidevice currentdevice].systemversion floatvalue] >=7.0)<span style="color: #0000ff;"><span style="color: #0000ff;">#import</span></span> <span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #800000;"><span style="color: #800000;">Uiimage+py.h</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">@implementation</span></span><span style="color: #000000;"><span style="color: #000000;">UIImage (PY)</span></span>+ (UIImage *) imagewithname: (nsstring *<span style="color: #000000;"><span style="color: #000000;">) name{</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(iOS7) {<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">the iOS7 here is to judge whether the IOS7 system</span></span>NSString *newname = [name stringbyappendingstring:<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">_os7</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">]; UIImage</span></span>*image =<span style="color: #000000;"><span style="color: #000000;">[UIImage imagenamed:newname]; </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(image = = Nil) {<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">pictures with no _os7 suffix</span></span>Image =<span style="color: #000000;"><span style="color: #000000;">[UIImage imagenamed:name]; } </span></span><span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">image; } </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">non-iOS7</span></span> <span style="color: #0000ff;"><span style="color: #0000ff;">return</span></span><span style="color: #000000;"><span style="color: #000000;">[UIImage imagenamed:name];}</span></span><span style="color: #0000ff;"><span style="color: #0000ff;">@end</span></span></pre><p><p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">Using the above + (UIImage <em>) imagewithname: (nsstring </em>) name method, there will be no hint, so we can import the picture is likely to be wrong, and the following plug-in is specifically to solve the problem!!!</span></p></p><p><p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">Baidu Ksimagenamed-xcode-master Open the project to run,</span></p></p><p><p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">Restart Xcode after you see the build success OK</span></p></p><p><p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">Below you can see the effect of oh!</span></p></p><p><p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;"></span></p></p><p><p></p></p><p><p></p></p><p><p><span style="font-family: ‘comic sans ms‘, sans-serif; font-size: 16px;">sometimes, we need to give other methods also provide a function of automatic reading image, at this time, we can in ksimagenamed this plug-in project Completions.plist file in the same format to add the required method name, and then compile it, as follows</span></p></p><p><p></p></p><p><p> IOS: automatically read the use of picture plugin Ksimagenamed-xcode-master </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.