嗨,在viewDidLoad的主要WiewController中我设置了一个
UIGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(processTap)];
Run Code Online (Sandbox Code Playgroud)
然后ia for循环我创建UIViews并将它们添加到滚动视图,然后将其添加到主视图中.
UIView *newsContainer = [[UIView alloc] initWithFrame:CGRectMake(160 * countnews, 30, 156, 126)];
newsContainer.tag = countnews;
newsContainer.userInteractionEnabled = YES;
[newsContainer addGestureRecognizer:recognizer];
[tempScroll addSubview:newsContainer];
Run Code Online (Sandbox Code Playgroud)
然后我有一个功能
- (void)processTap:(UITapGestureRecognizer *)recognizer {
UIView *view = recognizer.view;
NSLog(@"HELLO, %d", view.tag);
}
Run Code Online (Sandbox Code Playgroud)
从来没有被称为任何建议?非常感谢您的帮助.提前致谢.
这是整个.m
#import "iPadMainViewController.h"
#import "GradeintView.h"
#import <QuartzCore/CALayer.h>
#import "Category.h"
#import "News.h"
#import "LazyImageView.h"
#import "TouchView.h"
@interface iPadMainViewController ()
@end
@implementation iPadMainViewController
@synthesize detailsView = _detailsView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil …Run Code Online (Sandbox Code Playgroud) 可能重复:
TableView页脚正在与表滚动
我想为每个部分都添加一个页脚,该页脚不会发粘,并且会随着表格滚动
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)
此方法为页脚定义了一个“粘性”视图。
先感谢您