我想通过编程方式来配置视图。我有一个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