1. 为image view、label等组件添加动作
UIImageView *imgView = [[UIImageView alloc] init];
UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget: self action: @selector(imageViewClicked:)];
gesture.numberOfTouchesRequired = 1;
gesture.numberOfTapsRequired = 1;
[imgView addGestureRecognizer: gesture];
2. 获取一个实例的类名
Class cla = [imgView class];
NSString *des = [cla description];
3. UIToolBar支持blur(毛玻璃)效果,如果不想用开源代码,其实可以直接把toolbar当作view来用
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
toolbar.barStyle = UIBarStyleBlackTranslucent;
toolbar.translucent = YES;
4. 获取某个cell当前的origin.y
NSIndexPath *indexPath = [NSIndexPath indexPathForRow: btn.tag inSection: 0];
CGRect cellRect = [self.tableView rectForRowAtIndexPath: indexPath];
float y = cellRect.origin.y - self.tableView.contentOffset.y;