我已经查看过虽然以前的问题和对这个错误的答案,但我无法弄清楚我做错了什么。谁能帮忙?警告:从不同的Objective-C类型分配
@synthesize myScrollView;
@synthesize mathsPracticeTextArray;
-(void)loadText
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *textFilePath = [bundle pathForResource:@"mathspractice" ofType:@"txt"];
NSString *fileContents = [NSString stringWithContentsOfFile:textFilePath];
mathsPracticeTextArray = fileContents;
}
- (void)viewDidLoad {
[super viewDidLoad];
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 *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,100,960,40)];
myLabel.text = [mathsPracticeTextArray componentsJoinedByString:@" "];
[myScrollView addSubview:myLabel];
[myLabel release];*
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
}
- (void)dealloc {
[myScrollView release];
[mathsPracticeTextArray release];
[super dealloc];
}
@end
你可以把调试器的日志吗? – 2010-02-25 13:54:58
我从调试器中得到的所有信息都是“会话开始”,它实际上编译得很好,只有一个警告,但它没有显示我的文本mathspractice.txt – 2010-02-25 14:15:52
我需要IB中的标签吗? – 2010-02-25 14:17:13