iOS Development-No. 05-Projects-05-Home

Source: Internet
Author: User

1. drop-down refresh


1.1 go to homepage auto Refresh




1.2 Show the latest number of Weibo




Note: The popup UILabel That should be added to the navigation controller. View and should not be added to the TableView , or it will be more TableView scroll together!!!

After the send request succeeds, call the following method (note the animation):




2. Add a pull-up refresh control


1> Custom Hwloadmorefooter (XIB)

1. Uilabel Fill view with AutoLayout

2. Add a circle control, tick the animation




2> provides class methods for loading Xib controls




3> added to the Tablefooterview on TableView

Note: In order to prevent the start of entering too late to display TableView data, you need to first Tablefooterview hidden, otherwise it will be displayed directly!!!




4> Agent Monitoring ScrollView Scrolling, waiting to scroll to the last time display Tablefooterview and then automatically refresh

Note: ScrollView attribute Details --- Important






Note: contentsize is the scrolling area, you need to wait for the last Cell when it's fully displayed, it's only going to show Footerview !!






3, Weibo not reading


Use a timer every 60s to get the micro-bo unread.

Note 1 : Set Self.tabBarItem.badgeValue

Note 2 : After the refresh is successful, clear the Self.tabBarItem.badgeValue

Note 3 : Nstimer timer, if the main line is impersonating in the processing of other events, such as always scrolling, then the timer will not start, should tell the main thread, a little time to the timer, that is, modify Mainrunloop mode of the timer in

Note 4 : When you get the unread readings, you should also APP set the corresponding number on the icon






Note 5 : After the above method is complete, there is a problem once APP into the background, the timer does not work, it will not be able to obtain the micro-Bo unread, displayed in APP icon, you need to re-enter the background of the program to open background tasks

Note 6 : The time to open the background task below is still indeterminate and depends on the operating system CPU , memory and so on, may also be killed by the system.

Note 7 : To get more time, it's best to tell the operating system APP Background tasks are required to enter the background, Info.plst Set Background mode in: Required Background Modes ==app plays audio or streams audio/video using AirPlay , but it's still not sure how long it will run in the background.






4, adjust the Hwtitlebutton text picture spacing


In the previous 5.2 section of custom Hwtitlebutton, text and pictures are linked together




5. Cell Structure Analysis










6. Custom Cell Step---important


Note: each Cell of the height is different, each Cell It shows. content is also not same

1> Create a new subclass that inherits from UITableViewCell

2> initialization of child controls in the Initwithstyle: method

1. Add all child controls that are likely to be displayed to Contentview

2. By the way, set some properties of the child controls (one-time settings: font, text color, background)

3> offers 2 models

1. One is the data model (text data + picture data)

2. One is the frame model (data model + the height of the frame+ cell for all child controls)

4> cell should provide a Frame model property

1. Passing the frame model to the cell

2. Cell sets the frame to the child control according to the frame model, sets the data to the child control according to the data model

3. Cell determines which child controls are displayed and hidden based on the data model

5> the proxy method in TableView returns the height of the cell


7. Custom cell


7.1 Customizing Hwstatuscell, initializing Controls






Note: in Cell should be based on the Hwstatusframe Model ( contains both the hwstatus model and the frame that contains each control ) to configure Cell !!






Note: UILabel the font in should be calculated later Frame time of the font consistency!!!


7.2 Customizing the Hwstatusframe model




7.3 Set the cell data and each control frame


Hwstatuscell add-(void) Setstatusframe: (Hwstatusframe *) statusframe






7.4 Calculating the frame of a control in a cell


Hwstatusframe add-(void) SetStatus: (Hwstatus *) status

Note: To write a control to reach Frame appears a Frame the effect, for testing, you can write the outside code first ( proxy method for TableView )




Note: Body Frame the calculation!!!




7.5 Modifying code in Hwhomeviewcontroller


1> changes the original Hwstatus array to an Hwstatusframe array

2> changes the Hwstatus array returned by Sina to the Hwstatusframe array






3> Modify the Hwstatusframe where necessary

4> Add Tableview:heightforrowatindexpath: Proxy method




7.5 Hwuser and Hwstatus Add the required properties




Note: Rewrite the Setmbtype method to determine whether it is a member






iOS Development-No. 05-Projects-05-Home

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.