0
我正在刪除具有UIImage視圖的UITableView中的單元格。當我滑動刪除UIView後面的刪除按鈕時,如果UIView位於刪除按鈕後面,它看起來會更好。有沒有一種方法可以將按鈕的圖層首選項設置爲頂層?在UITableView後面的自定義UIView中刪除按鈕的問題
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
[context deleteObject:[self.fetchedResultsController objectAtIndexPath:indexPath]];
//Deletes view from cell
for (UIView *subview in [self.view subviews]) {
if (subview != self.tableView) {
[subview removeFromSuperview];
}
}
NSError *error = nil;
if (![context save:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
}
[self performFetch];
}
你寫的代碼如何?你想隱藏你的UIImageView? – sunkehappy
我不確定隱藏它,但我希望刪除按鈕位於頂部。我想隱藏按鈕後面的內容是可以的,但如果用戶決定不刪除,則需要取消隱藏。 – sonicbabbler