iOS learning sixth day Notes-problems encountered and solutions
Source: Internet
Author: User
<span id="Label3"></p><p><p>Today the nest in the bedroom is also ok, came to work overtime, to try to complete the layout of the app to my Task. It's going to be off Soon. Let's show you a little bit of work First.</p></p><p><p></p></p><p><p>alas, I found a major bug, which was run on the Iphone6 Simulator. But if you put it on the 5s or something, you'll find it's not exactly the Case.</p></p><p><p>Problems and Solutions:</p></p><p><p>1. The label is superimposed on the label method:</p></p><p><p>1>. Create a new UIView object--set Properties--self.view.addsubview:viewname</p></p><p><p>2>. Create a new Uilabel object, set the property, and then [viewName addsubview:labelname]. So Easy.</p></p><pre>UIView *backview = [[UIView alloc] initwithframe:cgrectmake (<span style="color: #800080;"><span style="color: #800080;">0</span></span>,<span style="color: #800080;"><span style="color: #800080;">0</span></span>, screen_width,<span style="color: #800080;"><span style="color: #800080;"></span> -</span><span style="color: #000000;"><span style="color: #000000;">)]; Backview.backgroundcolor</span></span>=<span style="color: #000000;"><span style="color: #000000;">[uicolor grouptableviewbackgroundcolor]; [self.view addsubview:backview]; </span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">I want to promote</span></span>UILabel *label = [[UILabel alloc] initwithframe:cgrectmake (<span style="color: #800080;"><span style="color: #800080;"></span> max</span>,<span style="color: #800080;"><span style="color: #800080;"></span> -</span>,<span style="color: #800080;"><span style="color: #800080;"></span> max</span>,<span style="color: #800080;"><span style="color: #800080;"></span> -</span><span style="color: #000000;"><span style="color: #000000;">)]; Label.font</span></span>= [uifont systemfontofsize:<span style="color: #800080;"><span style="color: #800080;"></span> -</span><span style="color: #000000;"><span style="color: #000000;">]; Label.text</span></span>=<span style="color: #800000;"><span style="color: #800000;">@"</span></span><span style="color: #800000;"><span style="color: #800000;">I want to promote</span></span><span style="color: #800000;"><span style="color: #800000;">"</span></span><span style="color: #000000;"><span style="color: #000000;">;</span></span><span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;">label.textalignment = uitextalignmentcenter;</span></span>Label.textcolor =<span style="color: #000000;"><span style="color: #000000;">[uicolor blackcolor]; [backview addsubview:label];</span></span></pre><p><p>2. Use Bottomlabel.backgroundcolor = [uicolor colorwithred:62 green:209 blue:185 alpha:1] background color no effect;</p></p><p><p>Workaround: first present the official API Documentation:</p></p><p><p></p></p><p><p>The RGB range is between 0~1, so the correct wording should be.</p></p><pre><pre>Bottomlabel.backgroundcolor = [uicolor colorwithred:<span style="color: #800080;">62.0</span>/<span style="color: #800080;">255</span> green:<span style="color: #800080;">209.0</span>/<span style="color: #800080;">255</span> Blue:<span style="color: #800080;">185.0</span>/<span style="color: #800080;">255</span> alpha:<span style="color: #800080;">1</span>];</pre></pre><p><p>3. Loading URL images in UI interface</p></p><p><p>Start with the Code:</p></p><pre><pre> Uiimageview *imgheadview = [[uiimageview alloc]initwithframe:cgrectmake (<span style="color: #800080;"></span><span style="color: #800080;"></span><span style="color: #800080;"></span><span style="color: #800080;">320 </span><span style="color: #000000;">)]; </span> *url = [nsurl urlwithstring:<span style="color: #800000;">@ "</span><span style="color: #800000;">https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket= gqgb8toaaaaaaaaaasxodhrwoi8vd2vpeglulnfxlmnvbs9xl04wvtrruehsddizt2jstkhjv2s5aaieoqxlvqmeaaaaaa==</span><span style="color: #800000;">"</span> <span style="color: #000000;">]; </span> *data =<span style="color: #000000;"> [nsdata datawithcontentsofurl:url]; </span> *aimage =<span style="color: #000000;"> [[UIImage alloc] initwithdata:data]; [imgheadview setimage:aimage]; [imgheadview setneedsdisplay]; [backview addsubview:imgheadview];</span></pre></pre><p><p>At first I thought I needed to use UIWebView and then create the Nsurlrequest object to get the Request. The above code is found on the Internet.</p></p><p><p>First introduce the next UIIMAGEVIEW.</p></p><p><p>1>. Initialization</p></p><p><p>Uiimageview *imgheadview = [[uiimageview alloc]initwithframe:cgrectmake (40, 200, 300, 320)];</p></p><p><p>2>. Set Picture UIImage</p></p>Here is one of the better ways to do This.<p><p>NSData *data = [nsdata datawithcontentsofurl:url];</p></p><p><p>UIImage *aimage = [[UIImage alloc] initwithdata:data];</p></p><p><p>[imgheadview setimage:aimage];</p></p><p><p>[imgheadview setneedsdisplay];</p></p><p><p>[backview addsubview:imgheadview];</p></p>This method uses NSData to load the Image. ----------------------(i'm a split Line)<span style="background-color: #00ccff;"><span style="background-color: #00ccff;">into Today's focus--tableview. </span></span>1 First understand the following important concepts: TableView is divided into two main categories: plain--general list style. Grouped--style of the Block. Like both of these Styles. Terminology: a behavior cell for Table view, and many cells can form sections, each section is divided into headers and footer, and many sections make up the entire table, Of course table also has headers and footer. That combination of your own to do the app interface will instantly understand the general Layout. (find a little trick, commend + DELETE combo key to delete a row) there are some common ways to add Time.<p><p> iOS learning sixth day Notes-problems encountered and how to fix them </p> </p></span>
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