James Gu
James Gu

Reputation: 1392

iOS - messaging app send picture

I'm working on a messaging app, I wonder how to get these effects when sending a picture (is there a library for this already since it's so commonly used in most messaging apps):

enter image description here

enter image description here

enter image description here

Upvotes: 1

Views: 121

Answers (1)

James Andrews
James Andrews

Reputation: 3304

To do this you just need to keep track of the total size of the image and how much as been transferred. This will depend on how you're sending the image. I was using a socket connection and I sent the image like this:

Network packet - [(int)length of packet][image data]

As soon as the first byte had arrived I knew the size of the image. Then I kept track of the amount transferred so far. I then passed this information to a MBProgressHUD which has an option to show a percentage. MBProgressHUD

Upvotes: 1

Related Questions