Goz*_*Goz 0 iphone objective-c uiview addsubview ios
我有另一个iOS相关问题.这次与UIView上的addSubView有关.
我在NSMutableArray中存储了一堆UIViewController类.我们的想法是,根据用户从UIPickerView中选择的内容,它会将选择器视图移开,然后显示与视图控制器关联的视图.
为此,我有以下代码:
[navItem setTitle: [cheatArray objectAtIndex:row]];
UIViewController* controller = [cheatViewControllers objectAtIndex: row];
if ( controller != nil )
{
CGPoint animateTo;
animateTo.x = thePickerView.bounds.size.width / 2;
animateTo.y = -thePickerView.bounds.size.height / 2;
[UIView animateWithDuration:0.5f delay: 0.0f options:UIViewAnimationOptionAllowUserInteraction animations:^{ [thePickerView setCenter: animateTo]; } completion:nil];
[self.view addSubView: controller.view];
}
Run Code Online (Sandbox Code Playgroud)
唯一的问题是,当我调用addSubView时,我收到一个错误:
-[UIView addSubView:]: unrecognized selector sent to instance 0x581ba00
Run Code Online (Sandbox Code Playgroud)
我很遗憾这是怎么发生的.addSubView怎么可能是一个无法识别的选择器.肯定是其中一个内置的.有没有人对这里发生的事情有任何想法?
| 归档时间: |
|
| 查看次数: |
1248 次 |
| 最近记录: |