Post File upload optimized version control for TableView line height calculation

Source: Internet
Author: User
Tags file url

Post uploads are encapsulated in the request body

1. File upload??????????????

Set profile picture/product Reviews There's no more packaging in iOS that requires you to go to an iOS for the most complex

2. Upload a file using post or put request????

The POST request body does not have a length limit that requires you to encapsulate the uploaded content in the request body

Post request in 3.AFN

Create a Network Tools management class

Afhttpmanager *manager

Suspending the request method

Manager post

Pass the dictionary in

One drawback of AFN is that it should not fail when a request to a few sentences resolves the data error.

Should be the request succeeds inside go back to fail

Post and get in AFN buy those hair no difference

4. How to go to AFN inside upload file parameters?????

Constructingbodywithblock

Post for two external use file upload

-(void) Postupload {

Afhttpsessionmanager *mgr = [Afhttpsessionmanager manager];

Upload

Nsdictionary *params = @{@ "username": @ "da Xiagua"};

[Mgr post:@ "http://localhost/upload/upload-m.php" Parameters:params constructingbodywithblock:^ (id< Afmultipartformdata> formData) {

/**

Parameters

1. local File URL

2. Name: The name of the field that is responsible for uploading the file, consulting the company's backend programmer, or having documentation

3. Error

*/

Nsurl *fileurl = [[NSBundle mainbundle] urlforresource:@ "04.jpg" withextension:nil];

[FormData appendpartwithfileurl:fileurl name:@ "userfile[]" error:null];

Uploading Multiple files

/**

Parameters

1. Local Document part URL

2. Name: The name of the field that is responsible for uploading the file, consulting the company's backend programmer, or having documentation

3. FileName: The file name of the server is guaranteed to exist

4. MimeType: Tell the server what type of file to upload

5. Error

*/

Nsurl *FILEURL2 = [[NSBundle mainbundle] urlforresource:@ "appicon.jpg" withextension:nil];

[FormData appendpartwithfileurl:fileurl2 name:@ "userfile[]" filename:@ "001.jpg" mimetype:@ "application/ Octet-stream "Error:null";

} success:^ (Nsurlsessiondatatask *task, id responseobject) {

NSLog (@ "%@", responseobject);

} failure:^ (Nsurlsessiondatatask *task, Nserror *error) {

NSLog (@ "%@", error);

}];

}

5. Why are memory spikes??????

1.2. The downloaded data is stored in memory and the data is downloaded more quickly than the data on the computer.

I

From GitHub above Git clone appeared that xcode-select--switch .... The probable cause is yours.

Xcode is not downloaded from the website or you have several versions of Xcode installed

Workaround Click Presence--location--command line Tools hang on.

How to check if the frame you downloaded is new or not, just drag the catalogue to the past.

and go straight to LS.

And then go back to git pull.

Version of the control

You're in the company, you might want to see the code first.

Then you can create a new branch--and then write a comment in it or how to

And then when you want to really write some small functions, you can

You have to commit all the changes before you switch the branch to see the commit. The M file is gone, then go inside master switch.

You'll find that you're back to the branch that you changed before.

TableView automatic calculation of row height

-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) Indexpath

When we set his specified width, we find that when we call the method of this line height, that is, every time we calculate the row height, he will be called the current number of the line.

Why is there a relationship between this performance method and the version?

The table is ScrollView Contsize determined to be able to scroll so many times is for accurate calculation contensize

Another method of method Estimateheightforrowatindexpath

Estimated Row Height

Once implemented, it will only call the current row two times instead of adding 2 times per row

Apple's official documentation is not recommended to use this estimated line-up proxy method to promote the use of attributes that go to viewdidload inside the call

This is more efficient, so you can set a property in the Viewdidload main to save the proxy method

Set the estimated row height

Self.tableView.estimatedRowHeight = 200;

Post File upload optimized version control for TableView line high calculation

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.