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