教科書上直接用[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];
}
}
uitestview怎樣追加數據寫入
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Quartz 2D 基礎
bitren520
2018-08-27 18:20:41
iPhone開發進階(2) --- iPhone應用程序/項目的構成
bitren520
2018-08-27 18:20:41
iOS-簡單sqlite使用
bitren520
2018-08-27 18:20:39
如何使用.net實現iPhone和電腦之間的文件傳輸
bitren520
2018-08-27 18:20:39
iPhone SDK開發:自定義UIAlertView
bitren520
2018-08-27 18:20:39
iOS-簡單使用core data
bitren520
2018-08-27 18:20:36
iOS中對文件的操作
bitren520
2018-08-27 18:20:34
UIViewAnimation with block
bitren520
2018-08-27 18:20:33
NSOperation and KVO/KVC coding
bitren520
2018-08-27 18:20:33
loadNibNamed 的使用
bitren520
2018-08-27 18:20:33
[筆記]I 羣聊天記錄2012/03/中
bitren520
2018-08-27 18:20:33
sqlite 操作工具 FMDB 更新update真好使
bitren520
2018-08-27 18:20:33
From SSH Connection Build Xcode iPhone Project
bitren520
2018-08-27 18:20:32
視圖彈出後放大又縮小的動畫實現、類似於alertView效果
bitren520
2018-08-27 18:20:32
iphone xcode 使用database 數據庫 sqlite3的使用注意項總結
bitren520
2018-08-27 18:20:30