tags:

views:

32

answers:

2

how to read data from an url link,and want to display it on my text view...... url link content contains only normal text

i am using

NSString *userAgreementStringURL = [NSString stringWithFormat:@"%@/requestConfigurationData.php?ownerID=%@&view=userAgreement", serverURL, ownerID]; NSURL *userAgreementURL = [NSURL URLWithString:userAgreementStringURL]; NSURLRequest *userAgreementRequest = [NSURLRequest requestWithURL:userAgreementURL]; userAgreementData = [[NSMutableData alloc] init]; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; userAgreementConnection = [[NSURLConnection connectionWithRequest:userAgreementRequest delegate:self] retain];

[userAgreementTextView setText:[NSString stringWithContentsOfURL:@"http://medicinephone.com/dev2/visit/requestConfigurationData.php?ownerID=13&view=userAgreement" encoding:NSUTF8StringEncoding error:NULL]];

A: 
[myTextView setText:[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://apple.com" encoding:NSUTF8StringEncoding error:NULL]]];

one line of code, thank you apple.

Edit: forgot to make a NSURL from the string.

NWCoder
how to display text on text view ,which is present in array ...
lak in iphone
is giving warning like incompatable types
lak in iphone
not working crashing application,can u help me
lak in iphone
A: 

Show us your code. If you are trying what I think you are trying passing an array to text view's setText method won't work. You need to get the string from the array prior to that. If you array contains one word per array element you might want to try using componentsJoinedByString.

Steam Trout
[userAgreementTextView setText:[NSString stringWithContentsOfURL:@"http://medicinephone.com/dev2/visit/requestConfigurationData.php?ownerID=13
lak in iphone
And what error are you getting exactly? Theoretically it should work.
Steam Trout