tom*_*mmi 1 iphone uibutton uiview ios
我正在尝试将UIButton添加到UIView,但我在运行时收到此错误.
NSInvalidArgumentException',原因:' - [UIView addSubView:]:无法识别
XCode也警告我
实例方法'-addSubView:'未找到(返回类型默认为'id')
这是我的代码:
UIView *trackPaneView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 768, 100)] autorelease];
[trackPaneView setBackgroundColor:[UIColor blueColor]];
UIButton *testButton = [[UIButton alloc] initWithFrame:CGRectMake(100, 10, 100, 30)];
[testButton setTitle:@"AWESOME" forState:UIControlStateNormal];
[trackPaneView addSubView:testButton]; //the error coming form this line
Run Code Online (Sandbox Code Playgroud)