【发布时间】:2015-01-29 15:31:14
【问题描述】:
当我在我的视图控制器中触摸一个按钮时,会启动这个简单的代码
- (IBAction)tapOnButton:(UIButton *)sender
{
UIActionSheet *act = [[UIActionSheet alloc] initWithTitle:@"test" delegate:self cancelButtonTitle:@"aa" destructiveButtonTitle:@"bb" otherButtonTitles:@"cc", nil];
[act showFromRect:CGRectMake(50, 50, 100, 100) inView:self.view animated:YES];
}
-(void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
}
}
我在屏幕上看到一个 Actionsheet,点击 Actionsheet 的任何按钮,它就会关闭。
当我运行时,我的 viewcontroller 没有执行 dealloc 。 如果您不触摸按钮并且不打开操作表,dealloc 将起作用。
是一个足够大的问题。有人在吗?
我使用的是 ios 8.1.3
【问题讨论】:
-
请将您的代码截图替换为代码的实际文本,以便人们阅读。
-
如果您在装有 iOS 7 的设备(或模拟器)上运行代码有什么问题吗?
-
我在 iOS 8.1 中遇到了同样的问题。也许这是 iOS 8 的错误?
标签: ios objective-c memory-leaks uiactionsheet ios8.1