我试图让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];
}
感谢名单...
你到底想干什么?您不能将方法分配给NSString *。 – mydogisbox 2012-04-20 16:10:33
问题是什么? – 2012-04-20 16:14:07