Introduction to the "facebook UI development Framework react Introduction to the eight" image (ios Platform)-goodmao

Source: Internet
Author: User
<span id="Label3"></p><span style="font-size:12px"><span style="font-size:12px"><span style="font-family:Helvetica">---------------------------------------------------------------------------------------------------</span></span></span><span style="font-size:12px"><span style="font-size:12px"><span style="font-family:Helvetica">React.native is an open source javascript-based open-source framework for facebook,</span></span></span><span style="font-size:12px"><span style="font-size:12px"><span style="font-family:Helvetica">apps that are handy for developing mobile Devices. </span></span></span><span style="font-size:12px"><span style="font-size:12px"><span style="font-family:Helvetica">moreover, It is convenient to update the UI and data of the app, and it is easy to deploy. </span></span></span><span style="font-size:12px"><span style="font-size:12px"><span style="font-family:Helvetica">Goodmao hope to help you get started quickly! </span></span></span><span style="font-size:12px"><span style="font-size:12px"><span style="font-family:Helvetica">----------------------------------------------------------------------------------------------------</span></span></span><span style="color:rgb(51,51,51)"><span style="color:rgb(51,51,51)"><br></span></span><span style="color:rgb(51,51,51)"><span style="color:rgb(51,51,51)">reference:</span></span>Style Style:http://facebook.github.io/react-native/docs/view.html#style View view:http://facebook.github.io/ React-native/docs/style.html#content<span style="color:rgb(51,51,51)"><span style="color:rgb(51,51,51)">image:</span></span>Https://facebook.github.io/react-native/docs/image.html#content<span style="color:rgb(51,51,51)"><span style="color:rgb(51,51,51)">color reference:<span style="color:rgb(51,51,51)">http://www.w3school.com.cn/html/html_colors.asp</span> </span></span><span style="color:rgb(51,51,51)"><span style="color:rgb(51,51,51)">Source Code reference:</span></span><span style="color:rgb(255,38,0)"><span style="color:rgb(255,38,0)">layout.h/.c File</span></span><span style="font-size:12px"><span style="font-size:12px"><span style="font-family:Helvetica">----------------------------------------------------------------------------------------------------</span></span></span><br>In this section, we briefly introduce the use of image images in order to let everyone understand and learn how to do it in Minutes.<br><br><span style="font-weight:bold"><span style="font-weight:bold">first, Image Introduction:</span></span>React can load and display images from a variety of sources, including: 1. Local static resource map, local temporary map, 2. Network diagram; 3. Local Disk map (for example, album or camera).<br><br><strong><strong>Ii. methods of Use</strong></strong><br>(1) local static figure using 1. Add pictures to the project after adding pictures to the project, the generated app directly contains the static picture resources, which can be used directly. There are two ways to add pictures to your project, a. Add folders and pictures directly in Xcode B. Add a picture to Images.xcassets<br><br><br>2. Load and display A. Define Style<pre name="code" class="javascript"><pre name="code" class="javascript">var styles = stylesheet.create ({ container: { //flex:1, flexdirection: ' row ', position: ' absolute ', top: + , left : ten, justifycontent: ' center ', alignitems: ' Center ', Backgroundcolor: ' #F5FCFF ', }, size: { width: height:150, },});</pre></pre>Note: you need to set the Flex property to 0 or use the default value, otherwise flex:1, the picture will be Stretched.<br><br><br>B. Create a class load and display a picture description: the method for importing a local static Resource graph is require (' image!1 '), where the parameter ' image ' represents the loaded picture file, the parameter ' 1 ' is the picture filename, two In the middle with an exclamation point '! '      Separated.                 Note: I tried to load JPG images in both ways, but it didn't show up, and I didn't find out why. If which one is done, please inform and share with friends!<pre name="code" class="javascript"><pre name="code" class="javascript">var helloreact = react.createclass ({ //set view image render:function () { return ( <view style = { styles.container}> <image style = {styles.size} Source = {require (' image!1 ')}//1. Images.xcassets picture /> <image style = {styles.size} Source = {require (' image!2 ')}//2. Add images paths and pictures directly to Xcode ( /> </View> ); });</pre></pre><br><br><br><br>(2) load and display the image of the server 1. Add picture to server in our test project Helloreact folder, with index.ios.js folder, Create folder save: server-image, store the following JS in the image file that needs to be loaded.<br><br><br>2. Load and display picture A. Style definition Ibid.<br>B. Create a class and load and display the network Diagram description: directly with the property uri: you can load the network picture, and support common picture format (png,jpg, etc.).<pre name="code" class="javascript"><pre name="code" class="javascript">var helloreact = React.createclass ({//create Component class //component rendering method //set View image render:function () { return ( <view style = {styles.container}> <image Source = {{uri: ' http://172.16.105.149:8081/server-image/ Goodmao.jpg '}}//3. Network Diagram style = {styles.size} /> </View> ); });</pre></pre><br><br>third, the Operation:<br><br><br>Description: pictures from the "little puppet app", fun it?! Like self-portraits of friends, do not miss, haha!<br><p><p>Introduction to the "facebook UI development Framework react Introduction to the eight" image (ios Platform)-goodmao</p></p></span>
Related Article

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.