- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
现在我的 UITableViewController 中有 2 个不同的 UIPickerView。我仅在点击表格中的某些单元格时显示它们。我想做的是每当我触摸拾取器外部时隐藏拾取器。是否有委托(delegate)方法或类似的方法来实现此目的?我更喜欢将 Controller 保留为 UITableViewController 而不是简单的 UIViewController,因为我在其中一个单元格中有一个 textView,并且在键盘显示后滚动在 UIViewController 中有点太多了。
提前致谢。
最佳答案
可能的解决方案之一是,当点击特定单元格并处理选择器(以显示选择器)时,您可以在表格 View 上插入一个名为“MASK View”的 View 。 (框架为 self.tableview.frame - yourPicker.frame.size.height )。现在,当您点击此 View 时,您可以按如下方式处理它
-(void)showMaskView{
if (!viewMaskView) {
CGRect viewRect = CGRectMake(0, 0, self.tableView.frame.size.width, self.tableView.frame.size.height - yourPicker.frame.size.height);
viewMaskView = [[MaskView alloc] initWithFrame:viewRect];
viewMaskView.delegate = self;
}
[self.view addSubview:viewMaskView];
[self.view bringSubviewToFront:viewMaskView];
}
-(void)removeMaskView{
if (viewMaskView) {
[viewMaskView removeFromSuperview];
}
//Remove the Picker
}
在 MaskView 类中,您可以按如下方式处理触摸
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
if(self.delegate && [self.delegate respondsToSelector:@selector(removeMaskView)])
[self.delegate removeMaskView];
}
您可以在图像中的选取器上看到彩色蒙版 View 。当点击时,它会删除选择器。
关于iphone - 触摸外部时隐藏 UITableViewController 中的 UIPickerView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6299453/
我正在使用 Swift 制作一个应用程序,但遇到了一个问题:我有一个系统,人们可以在其中发布“帖子”,并对这些“帖子”发表评论。 为了显示这一点,我有一个 UITableViewController
用户点击“远程”按钮,然后加载以下 UITableViewController: 然后用户选择我调用的任何值: [self.navigationController popViewController
在我离开页面并使用 UITabBarController 返回后,我的 TableViewController 在页面顶部留下了一个空隙。在初始加载时它很好,只有当我离开页面然后返回时才会出现间隙。我
我有一个 TableViewController (VC1) 设置为推送到另一个 TableViewController (VC2)。这个连接是通过从 VC1 到 VC2 的 ctrl-drag 在
在我的核心数据模型中,我有一个 Person 实体,它与 Course 实体具有“对多”关系(我还具有从 Course 到 Person 的反向“对一”关系)。 现在我有一个子类化的 UITableV
为什么不调用 numberOfSectionsInTableView 方法?如果我在 viewDidLoad 中添加 [self.tableView reloadData],它就会被调用,但即便如此,
在 UITableViewController 中,我有一个方法可以更新显示总价的底部工具栏。 public override UITableViewCell GetCell(UITa
我正在制作一个 iPad 应用程序,其中包含一个用于设置选项的 View 。这个“选项” View 有两个容器 View ,每个容器 View 都包含一个 TableView,其中包含两种不同的选项,
假设设置是 导航 Controller -> GradLevelUITableViewController -> DegreeUITableViewController -> View Control
我的问题是,这是否可能,如果可能,您将如何完成这项任务? 有人知道已经在使用此功能的应用程序,或者可以从哪里获得一些示例代码吗? 此外,如果我要在对主题了解不多的情况下自行实现此操作,您估计需要多长时
当 UITableViewController 的框架低于特定高度时,UITableViewController refreshControl 会出现问题。 就目前而言,我有一个 UIViewCont
我有我的主视图和一个 RoutinesTableViewController。 我想放松回到我的 VC 并尝试了这个: @IBAction func selectRoutine(segue:UISto
我是 swift 和 Xcode 的新手,我正在尝试一些事情。当我转到设置页面时,我想在设置页面(在应用程序中,而不是在设置 bundle 中)设置开关状态。 (我将segue设置为push)为此,我
我目前正在尝试将不同的实体从我的 CoreData 模型加载到一个 UITableView 中,但位于不同的部分下。我尝试过以下方法: override func tableView(tableVie
我试图让 tableview 适应 Swift 中键盘的显示。根据文档,如果 tableview 是 UITableViewController 的子类,它应该自动调整。已经在这里阅读了很多答案,只是
我想捕获UITableViewController中触摸点的x位置。网上描述的最简单的解决方案是UITapGestureRecognizer:enter link description here 但
我是 iPhone 编程的初学者。我的第一个应用程序是 UITableViewController 但现在我想尝试一下。这个想法是创建一个如下所示的自定义布局: 布局: ---------------
我有一个基于导航的应用程序,我将 UITableViewControllers 推送到堆栈上。我想向我的所有 UITableViewControllers 添加背景 UImage。不是 UIColor
在找到位置后,我尝试在 UITableViewController 中重新加载数据。这也意味着在 viewDidLoad 方法之后。我的类正在使用此接口(interface)扩展 UITableVie
我有一个TabBarController,其中一个选项卡包含一个 subview ,它是一个navigationController。然后,我将继承 UITableViewController 形式的
我是一名优秀的程序员,十分优秀!