iPhone – load images into UIImageView using NSURLConnection

Hi everyone. I am really good at this obj-c/xcode stuff. I am trying to load the background of my xib file. To do this, I am using UI ImageView And fill it with the image I found from the internet. The problem is that it is really slow. It feels like it is crashing, but it is not the case. I was told to use NSURLConnection to solve the problem, but don’t know how. This is what I used before Code.

wallpaper.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://mysite.com/mobile /wallpaperR.asp?id=%i",customerID]]]];

How to convert the above code into NSURLConnection equivalent code?

NSURLConnection will download the data in a new thread, so your application will feel faster. < p>

It’s easy to implement, but it does require you to understand the concept of delegation.

I have a useful class to create and handle image downloads on a separate thread, and I will work with You share the code and let you know what happened through comments:

AsyncImage.h

AsyncImage.m

If you need help implementing it, just Leave a comment, I can help you achieve it, I remember when I started development, it was also painful for me.

Hello everyone. I am really good at This obj-c/xcode thing. I am trying to load the background of my xib file. To do this, I am using UI ImageView and filling it with the image I found from the internet. The problem is that it is really slow. It feels like it’s crashing, but it’s not. I was told to use NSURLConnection to solve the problem, but I don’t know how. This is the code I used before.

 wallpaper.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://mysite.com/mobile/wallpaperR.asp?id=%i",customerID]]]]; 

How to convert the above code into NSURLConnection equivalent code?

NSURLConnection will download the data in a new thread, so your application will feel faster.

It's easy Implementation, but it does require you to understand the concept of delegation.

I have a useful class to create and handle image downloads on a separate thread, I will share the code with you, and let you know what happened through comments What:

AsyncImage.h

AsyncImage.m

If you need help implementing it, just leave a comment, I can help you implement it, I remember It was also painful for me when I started development.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1060 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.