在自定义UITableViewCell中创建了一个按钮. 想在点击该按钮时知道该按钮所在的cell在TableView中的行数.就是cell的 indexPath.row两种方法都很好.-(IBAction):(id)sender{    NSLog(@"MyRow:%d",[self.table indexPathForCell:((TableViewCell*)[[sender   superview]superview])].row); //这个方便一点点,不用设置tag.   …
在UITableView或UICollectionView的自定义cell中创建一button,在点击该按钮时知道该按钮所在的cell在UITableView或UICollectionView中的行数.就是cell的 indexPath.row,下面以UITableView为例: 有两种方法: -(IBAction):(id)sender { 1. 第一种方法,这个方便一点点,不用设置tag.    NSLog(@"MyRow:%d",[self.table indexPathForC…
自定义UITableViewCell上的delete按钮 滑动列表行(UITableViewCell)出现删除按钮时,默认是英文“delete”,这份代码片段能够将“delete”变成中文”删除“,甚至可以自定义删除按钮的形状. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 4…
#pragma mark - UISearchBarDelegate//当搜索文本被改变的时候调用 - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { //改变searchController中tableView的位置 _searchController.searchResultsTableView.frame = CGRectMake(kZero, _tableViewY, kScr…
============================================================ 博文原创,转载请声明出处 电子咖啡-专注于移动互联网 ============================================================ 我们用这种方法去创建cell - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndex…
#import <UIKit/UIKit.h> @class ZSDCustomCell; //协议 @protocol ZSDCustomCellDelegate <NSObject> //判断选择某行以及某行中的按钮 -(void)deleteDidSelectCell:(ZSDCustomCell *)customCell andClickButton:(int)selectButtonIndex; @end @interface ZSDCustomCell : UITabl…
ios7 =< System Version< ios8 : ios7 =< System Version < ios8  下 button.superview.superview .superview 是获取按钮所在的cell  NSLog(@"2: cell ---- %@", button.superview.superview.superview); 2014-10-07 10:23:55.583 NeiHanShe[1407:60b] 2: cell…
4.点击Cell中的按钮时,如何取所在的Cell:-(void)OnTouchBtnInCell:(UIButton *)Btu{CGPoint point = btn.center;point = [table convertPoint:point fromView:btn.superview];NSIndexPath* indexpath = [table indexPathForRowAtPoint:point];UITableViewCell *cell = [table cellFor…
1.先创建一个View继承 UITableViewCell并使用xib快速建立模型. #import <UIKit/UIKit.h> #import "Score.h" @interface ShowScoreCell : UITableViewCell //在.h文件中声明对象@property(nonatomic,strong)Score *score; @end 2.把需要的控件拖上xib并调整xib的大小 3.把对应控件连线至.m文件中 #import "…
- (void) del:(UIButton *) button { NSLog(@"%s",__FUNCTION__); UITableViewCell * cell = (UITableViewCell *) [[button superview] superview]; NSIndexPath * path = [self.favouriteTableView indexPathForCell:cell]; NSLog(@"index row = %d",pa…