uitestview怎樣追加數據寫入

教科書上直接用[self appendTextToView:newText];編譯提示問題: warning: 'netclientViewController' may not respond to '-appendTextToView:' 
後來網上又找到2個方法,第一種:NSRange theEnd = NSMakeRange([[textView string] length], 0); 
[textView replaceCharactersInRange:theEnd withString:newText]; 
第一行提示: warning: 'UITextView' may not respond to '-string' 
第二行提示: warning: 'UITextView' may not respond to '-replaceCharactersInRange:withString:' 

第二種:[[[textView textStorage] mutableString] appendString: string];
也是提示類似的錯誤warning: 'UITextView' may not respond to '-textStorage' 


各位同學請幫幫忙,uitestview應該怎樣追加數據啊? 


前後代碼: 
-(void) loadURL{ 
NSURL*url = [[NSURLalloc] initWithString:urlField.text]; 
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; 
NSURLConnection*connection =[[NSURLConnectionalloc] initWithRequest:request 
delegate:self]; 
[connection release]; 
[request release]; 
//[url release]; 

-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ 
NSLog(@"connectionDidReceiveData"); 
NSString *newText = [[NSString alloc] initWithData:data 
encoding: NSUTF8StringEncoding]; 
if (newText != NULL) { 
//[self appendTextToView:newText]; 
NSRange theEnd = NSMakeRange([[textView string] length], 0); 
[textViewreplaceCharactersInRange:theEnd withString:newText]; 
[newText release]; 

} 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章