我想通過編程方式來配置視圖。我有一個UIViewController,並希望添加一個UIButton到它的視圖。訪問一個viewControllers視圖
嗯,我創建的按鈕:
UIButton *newViewButton = [[UIButton alloc] initWithFrame:CGRectMake(baseX + viewPlusX, baseY + viewPlusY, viewWidth, viewHeight)];
[newViewButton setTitle:@"View" forState:UIControlStateNormal];
[newViewButton setTag:(int)key];
[newViewButton addTarget:myViewController action:@selector(viewButton:) forControlEvents:UIControlEventTouchUpInside];
,但試圖將它添加到視圖
[myViewController.view addSubview:newViewButton];
我得到的錯誤時
error: expected ':' before":" token
任何線索,我是什麼做錯了
個問候
你真的應該開始接受答案,幫助你。您通過點擊有用答案左上角的複選標記來接受答案。 – Till 2010-04-20 15:27:02