我试图让 UILabel.text 采用 NSString 自定义函数,但被错误难住了。我仍然是 iOS 的新手,但我的直觉表明它与语法有关。
- (void)viewDidLoad
{
...
//Creating scrollable view
CGRect scrollViewFrame = CGRectMake(0, 0, 320, 460);
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:scrollViewFrame];
[self.view addSubview:scrollView];
CGSize scrollViewContentSize = CGSizeMake(320, 800);
[scrollView setContentSize:scrollViewContentSize];
//Inserting Title
UILabel *title = [[UILabel alloc]init];
[title setFrame:CGRectMake(0, 0, 300, 40)];
title.backgroundColor = [UIColor clearColor];
title.text = self.setQuestion;<-error
[scrollView addSubview:title];
[title release];
}
- (void) setQuestion{
NSString *qn = [NSString stringWithFormat:@"What do you get with%@", 5];
}
提前谢谢...