我實際上開始放棄生活的意願,這段代碼讓我瘋狂!從數組解析txt到UILabel
我試圖讓mathspractice.txt的內容轉換成* myLabel
我使用數組是:
-(void)loadText
{
NSArray *wordListArray = [[NSArray alloc] initWithArray:
[[NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@」mathspractice」 ofType:@」txt」]
encoding:NSMacOSRomanStringEncoding error:NULL] componentsSeparatedByString:@」\n」]];
self.theMathsPractice = wordListArray;
[wordListArray release];
}
,然後我試圖把它傳遞到* myLabel
UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,100,960,40)];
myLabel.text = *theMathsPractice;
[myScrollView addSubview:myLabel];
[myLabel release];
}
任何人都可以幫忙嗎?
謝謝本,我明白我現在失蹤了什麼...我會回來!再次感謝 – 2010-02-24 16:41:43