wwdc14yh / HyPopMenuView

模仿新浪微博弹出菜单
726 stars 186 forks source link

弹出菜单后,点击选项,发现并不是所有的都有放大的动画 #16

Closed jokerxsun closed 7 years ago

jokerxsun commented 7 years ago

HyPopMenuView.m 文件内,- (void)selectedFunc:(PopMenuButton *)sender 方法有问题

 NSLog(@"点击按钮的标题>>>>>>>>>>>>>>>>>>>>>>>>%@", sender.model.titleString);

// sender.layer.cornerRadius = CGRectGetWidth(sender.frame)/2; // sender.backgroundColor = [UIColor redColor]; //UIWindow window = (id)[self getMainView]; __weak HyPopMenuView weakView = self; for (PopMenuModel obj in _dataSource) { PopMenuModel model = obj; NSLog(@"遍历到的按钮>>>>>>>>>>>>%@", obj.titleString); PopMenuButton button = (id)model.customView; if (sender == button) { [sender selectdAnimation]; }else{ [button cancelAnimation]; } dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [model performSelector:@selector(_obj)]; }); } 其中的判断方式,sender == button, 并不安全 image sender 地址出现重复,放大效果有问题。