我試圖讓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