- (void)setUpGroup2 { ILGroupItem *group = [[ILGroupItem alloc] init]; // 结束时间 ILSettingItem *endTime = [ILSettingItem itemWithImage:nil title:@"结束时间"]; endTime.subTitle = @"23:59"; // __unsafe_unretained __weak // __weak会把指针自动清空 p = nil ,能防止野指针错误 // typeof(self) // 获取类型 __unsafe_unretained typeof(self) scoreVc = self; endTime.option = ^(NSIndexPath *indexPath){ UITableViewCell *selCell = [scoreVc.tableView cellForRowAtIndexPath:indexPath]; UITextField *textField = [[UITextField alloc] init]; [textField becomeFirstResponder]; textField.inputView = [[UIDatePicker alloc] init]; // iOS8会自动做键盘处理,前提是把textField加入到对应cell [selCell addSubview:textField]; }; group.items = @[endTime]; [self.groups addObject:group]; }
时间: 2024-10-20 15:06:28