65.
66. [self deleteCell:cell]; 67. }]; 68. }
69. //第三个单元格
70. else if (indexPath.row % kMCNumItems == 2) { 71. //设置单元格的主标题、副标题
72. [cell.textLabel setText:@\];
73. [cell.detailTextLabel setText:@\]; 74.
75. //设置单元格的选中视图、颜色、状态、完成后的block 76. [cell setSwipeGestureWithView:checkView color:greenColor
mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState1 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
77. NSLog(@\Checkmark\\\ 78. }]; 79.
80. //设置单元格的删除视图、颜色、状态、完成后的block 81. [cell setSwipeGestureWithView:crossView color:redColor
mode:MCSwipeTableViewCellModeExit state:MCSwipeTableViewCellState2 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
82. NSLog(@\Cross\\\ 83.
84. [self deleteCell:cell]; 85. }]; 86. }
87. //第四个单元格
88. else if (indexPath.row % kMCNumItems == 3) { 89. //设置单元格的主标题、副标题
90. [cell.textLabel setText:@\]; 91. [cell.detailTextLabel setText:@\]; 92.
93. //设置图标是否移动
94. cell.shouldAnimateIcons = NO; 95.
96. //设置单元格的选中视图、颜色、状态、完成后的block 97. [cell setSwipeGestureWithView:checkView color:greenColor
mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState1 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
98. NSLog(@\Checkmark\\\ 99. }]; 100.
101. //设置单元格的删除视图、颜色、状态、完成后的block 102. [cell setSwipeGestureWithView:crossView color:redColor
mode:MCSwipeTableViewCellModeExit state:MCSwipeTableViewCellState2 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
103. NSLog(@\Cross\\\ 104.
105. [self deleteCell:cell]; 106. }]; 107. }
108. //第五个单元格
109. else if (indexPath.row % kMCNumItems == 4) { 110. //设置单元格的主标题、副标题
111. [cell.textLabel setText:@\]; 112. [cell.detailTextLabel setText:@\]; 113.
114. //设置单元格的定时视图、颜色、状态、完成后的block 115. [cell setSwipeGestureWithView:clockView color:yellowColor
mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState3 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
116. NSLog(@\Clock\\\ 117. }]; 118.
119. //设置单元格的列表视图、颜色、状态、完成后的block
120. [cell setSwipeGestureWithView:listView color:brownColor
mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState4 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
121. NSLog(@\List\\\ 122. }]; 123. }
124. //第六个单元格
125. else if (indexPath.row % kMCNumItems == 5) { 126. //设置单元格的主标题、副标题
127. [cell.textLabel setText:@\];
128. [cell.detailTextLabel setText:@\]; 129.
130. //设置第一个触发事件的距离百分比 131. cell.firstTrigger = 0.1; 132.
133. //设置第二个触发事件的距离百分比 134. cell.secondTrigger = 0.5; 135.
136. //设置单元格的选中视图、颜色、状态、完成后的block 137. [cell setSwipeGestureWithView:checkView color:greenColor
mode:MCSwipeTableViewCellModeSwitch state:MCSwipeTableViewCellState1 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
138. NSLog(@\Checkmark\\\ 139. }]; 140.
141. //设置单元格的删除视图、颜色、状态、完成后的block 142. [cell setSwipeGestureWithView:crossView color:redColor
mode:MCSwipeTableViewCellModeExit state:MCSwipeTableViewCellState2 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
143. NSLog(@\Cross\\\ 144.
145. [self deleteCell:cell];
146. }]; 147. }
148. //第七个单元格
149. else if (indexPath.row % kMCNumItems == 6) { 150. //设置单元格的主标题、副标题
151. [cell.textLabel setText:@\]; 152. [cell.detailTextLabel setText:@\]; 153.
154. //设置单元格的删除视图、颜色、状态、完成后的block 155. [cell setSwipeGestureWithView:crossView color:redColor
mode:MCSwipeTableViewCellModeExit state:MCSwipeTableViewCellState1 completionBlock:^(MCSwipeTableViewCell *cell, MCSwipeTableViewCellState state, MCSwipeTableViewCellMode mode) {
156. NSLog(@\Cross\\\ 157.
158. //设置要删除的单元格 159. _cellToDelete = cell; 160.
161. //创建弾框
162. UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@\删除?\ 163. message:@\你确定要删除这个单元格?\ 164. delegate:self
165. cancelButtonTitle:@\否\ 166. otherButtonTitles:@\是\, nil nil]; 167. [alertView show]; 168. }]; 169. } 170. }
5.创建图片视图
[objc] view plaincopyprint?
1. //创建图片视图
2. - (UIView *)viewWithImageName:(NSString *)imageName { 3. UIImage *image = [UIImage imageNamed:imageName];
相关推荐: