// // CCTableTipView.m // CCFC // // Created by xichen on 11-12-16. // Copyright 2011 ccteam. All rights reserved. // #import "CCTableTipView.h" #import <QuartzCore/QuartzCore.h> @implementation CCTableTipView @dynamic delegate; - (id)initWithFrame:(CGRect)frame withTableViewFrame:(CGRect)tableViewRect { self = [super initWithFrame:frame]; if (self) { _tableView = [[UITableView alloc] initWithFrame:tableViewRect style:UITableViewStylePlain]; _tableView.layer.masksToBounds = YES; _tableView.layer.cornerRadius = 10.0; _tableView.alwaysBounceVertical = TRUE; _tableView.backgroundColor = [UIColor clearColor]; [self addSubview:_tableView]; [_tableView release]; } return self; } - (void)dealloc { [super dealloc]; } - (void)setDelegate:(id)delegate { _tableView.dataSource = delegate; _tableView.delegate = delegate; } - (void)show { [super show]; } - (void)setTableViewBgView:(UIImage *)img { UIImageView *bgView = [[UIImageView alloc] initWithImage:img]; _tableView.backgroundView = bgView; [bgView release]; } - (void)reloadData { [_tableView reloadData]; } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint point = [touch locationInView:self]; if(!CGRectContainsPoint(_tableView.frame, point)) { [super hide]; // 如果不在_tableView的范围内,界面默认自动消失 } } - (void)drawRect:(CGRect)rect { [super drawRect:rect]; } @end
可能有更新:
googlecode链接地址:http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCTableTipView.m
github地址: https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCTableTipView.m
本文将介绍如何在iOS应用中使用CCTableTipView组件,包括其初始化、配置、显示和触摸事件处理等核心功能。通过实例演示,帮助开发者快速掌握组件的使用方法。
100

被折叠的 条评论
为什么被折叠?



