0
任何人都可以注意到在這種編碼錯誤?NSARRAY編碼錯誤
NSString *textFilePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"txt"];
NSString *fileContents = [NSString stringWithContentsOfFile:textFilePath encoding:NSUTF8StringEncoding error:NULL];
practiceContent = [fileContents componentsSeparatedByString:@" "];
myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
myScrollView.contentSize = CGSizeMake(320,960);
myScrollView.pagingEnabled = FALSE;
myScrollView.scrollEnabled = TRUE;
myScrollView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:myScrollView];
UILabel *lblText = [[UILabel alloc] initWithFrame:CGRectMake(0,100,960,40)];
lblText.text = practiceContent;
[myScrollView addSubview:lblText];
[lblText release];
我試圖從文本的text.txt進入的標籤上滾動型...它沒有顯示出錯誤時,它編譯...
在此先感謝
究竟發生了什麼呢? – 2010-03-15 13:49:59
您是否嘗試過插入NSLog(@「\ n TEXT CONTENTS:%@」,practiceContent);到你的代碼輸出到控制檯的內容? – 2010-03-15 13:52:29