Despite all of the answers on here telling you to do this in one line of code, it will sadly make no difference to the URL connection speed OR data / image decoding. If you want a faster way to TYPE the code then fine, but I would use category added to UIImageView.
Despite all of the answers on here telling you to do this in one line of code, it will sadly make no difference to the URL connection speed OR data / image decoding. If you want a faster way to TYPE the code then fine, but I would use category added to UIImageView.... @interface UIImageView (URL) - (void)loadFromUrl:(NSString *)aUrl; @end @implementation UIImageView (URL) - (void)loadFromUrl:(NSString *)aUrl { NSURL *url = NSURL urlWithString:aUrl; NSData *data = NSData dataWithContentsOfURL:url UIImage *image = UIImage imageWithData:data; if(image! = nil) { self setImage:image; } } @end Now you can include the header and do... myImageView loadFromUrl:@"
"; For more categories (I will be adding this one to my list!) check here.Those are all my useful ones, you may find them useful too! :).
2 best thing about this is it can be kept and re-used, across classes and across projects! – Daniel Hanly Jun 13 at 11:01 2 The power of categories! – Simon Lee Jun 13 at 11:03 @ Daniel Hanly , @Simon Lee :Does it make any difference on the speed of downloading image through URL?
– Jhaliya Jun 13 at 11:08 No, as I said, sadly not, there is little you can do due to network limitations / bandwidth / image size etc :( ....but I was merely presenting a more re-usable version of making it easier to type. – Simon Lee Jun 13 at 11:10 it's a matter of comparing myImageView. Image = UIImage imageWithData:NSData dataWithContentsOfURL:NSURL URLWithString:@"
"; with myImageView loadFromUrl:@""; – Daniel Hanly Jun 13 at 11:52.Use everything in a single statement. UIImage *image = UIImage imageWithData:NSData dataWithContentsOfURL:NSURL URLWithString:MyURL.
– Simon Lee Jun 13 at 10:42 @Simon Lee : Agree, But in both cases the speed depend on the network Connectivity .. – Jhaliya Jun 13 at 10:45 1 This IS a faster way to type it, but not a faster way to process it. I think the OP is talking about a faster processing speed not faster typing speed. – Daniel Hanly Jun 13 at 11:02.
UIImage *image = UIImage imageWithData:NSData dataWithContentsOfURL:imageUrl.
Try this:- image is UIImage and imageView is UIImageView NSData *receivedData = NSData dataWithContentsOfURL:@"yoururl"; self. Image=nil; UIImage *img = UIImage alloc initWithData:receivedData ; self. Image = img; img release; self.
ImageView setImage:self.image.
Despite all of the answers on here telling you to do this in one line of code, it will sadly make no difference to the URL connection speed OR data / image decoding. If you want a faster way to TYPE the code then fine, but I would use category added to UIImageView....
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.