iphone - ScrollView 中的 UITableView

标签 iphone objective-c ios uitableview scrollview

好吧,我对这种层次结构有一个看法

                        Main View (having some Functions as well)

                            |
                        ScrollView (added now)
                            |
                         UIView (having other features)
                            |
                        UITableView (loading from xmls)

我知道苹果不推荐这种类型的 View 层次结构,但最后一刻我的客户需要 ScrollView 中的整个 View ,因为我的基础只是一个 View (具有一些其他功能)我在那里添加了一个 TableView (通过 xml 加载,因此无法更改或编辑 tableview),现在在我的主视图中添加 ScrollView 后,tableView 的最后一个单元格(自定义单元格)在点击时没有响应(在某些区域)。

我无法在表格中添加页眉或页脚来解决我的问题!!!

我现在很困惑,我该怎么办????

请给我任何建议,以便我的 TableView 能够正确响应....

TIA!!!

最佳答案

您将需要提供更多信息 - 这些层次结构是如何构建的?它们之间的关系在哪里以及它们之间的关系是什么?我怀疑这是 View 阻止您的触摸事件的问题,但除非您提供信息,否则我们无法确定。作为开始,我会尝试为层次结构中的每个 View 提供一个标签,并为 UIView 添加一个包含以下内容的类别:

UIView+Debug.h:

#import <Foundation/Foundation.h>


@interface UIView (Debug) 

@end

UIView+Debug.m:

#import "UIView+Debug.h"

@implementation UIView (Debug)


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    NSLog(@"Touch caught on %@\n",NSStringFromClass([self class]));
    NSLog(@"Tag: %d",[self tag]);
    [super touchesBegan:touches withEvent:event];
}


@end

这样,您就会知道在每个区域中哪个 View “窃取”了您的触摸事件。祝你好运!

关于iphone - ScrollView 中的 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8601488/

相关文章:

iphone - ios - 如何在 ios 中解析 HTML 内容?

ios - 在两点/触摸之间拉伸(stretch) SKSpriteNode

ios - 当 AlertController 出现时,UICollectionViewFlowLayout 错误

objective-c - Main 中 UIApplicationMain 之后的 Objective C 执行顺序是什么?

ios - 获取 iOS 开发的配置证书时出错

objective-c - 为 NavBar 的标题添加阴影

ios - Swift - 如何确保标签跟随 slider 的缩略图?

iphone - Xcode 上奇怪的编译时错误

IOS Storyboard : Load Multiple Subviews for given position

ios - 使用 updateApplicationContext 发送钥匙串(keychain)值是否安全