Subscribe ( )

iPhone Programming Tutorials


 

Forum

You must be logged in to post Login Register

Search 

use URL to display image

User Post

8:12 am
August 25, 2008


bobcubsfan

iCoder

Los Angeles

posts 54

1

Trying to display an image I have stored using my web host.

Normally to dispaly an image this works per Apple example:

view2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"sample.tiff"]];

But instead of the image file <sample.tiff> I want to display the same image which is stored at

I have looked at the code for retrieving a URL in UICatalog, and can display the web page, but I cannot figure out how to display the image.

4:04 pm
August 25, 2008


hijinks

iCoder

posts 6

2

if view2 is a UIImageView


view2.image = [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString:@"http://www.domain.com/image.jpg"]]];

I go over a lot of that is my JSON sections of my blog at



hope it helps

5:15 pm
August 25, 2008


bobcubsfan

iCoder

Los Angeles

posts 54

3

thanks for the reply.


This works:

view2 = [[UIImageView alloc] initWithImage:[UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString:@"http://www.schoenburg.com/my.TIF"]]]];

7:46 pm
August 25, 2008


Admin

brandontreb

posts 88

4

Great find hijinks!

That looks like a great tutorial.  After the Todo List series, I will probably have some web service tutorials on icodeblog.  they will probably use XML-RPC. 

Thanks for contributing that resource!

If debugging is the process of removing bugs, then programming must be the process of putting them in.
-Edsger Dijkstra

11:30 pm
August 25, 2008


bobcubsfan

iCoder

Los Angeles

posts 54

5

Okay, I got it to work, but, and this should be simple, but then what is with iPhone programming?

After defining two strings, NSString *one; and NSString *two; and using @property etc… and @synthsize …

I cannot find a way to concantenate the strings. So if one=”Hello”; and two =”world”; I want the result to be

“Hello world” stored in one. I would think it might be: one=one + two; but that generates and error.


5:53 am
August 26, 2008


hijinks

iCoder

posts 6

6

The best way to do that is with a NSMutableString

NSMutableString *hello = [[NSMutableString alloc] initWithString:@"Hello"];

[hello appendString:@" World"];

7:54 am
August 26, 2008


bobcubsfan

iCoder

Los Angeles

posts 54

7

Hijinks,


Thanks again. Why does Apple make it so difficult to find things like appendString? Maybe I am missing something

but I just cannot seem to find a reference to key words like this.

2:58 pm
August 26, 2008


hijinks

iCoder

posts 6

8

it is right in the NSMutableString reference

Their docs aren't really meant for new programers from what I can see. I come from a C background so its a lot easier for me to grasp. I have also done years of PHP work and if you come from that type of background the docs can be difficult since PHP isn't really Object Oriented in design

11:10 pm
August 26, 2008


bobcubsfan

iCoder

Los Angeles

posts 54

9

Your example worked for me. This is Apple's

- (void)appendString:( *)aString

The problem is that this is method which as I understand it cannot be placed inside another method. Apple also does

not give examples. I have programmed in Visual Basic, Visual FoxPro and PHP. The first two are objective in that you

might have a statement like this:

myText.Bold =TRUE; or myText.font =”Times Roman”;

Thanks again.

Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

1 Guest

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.