reloaddata

Why can't I call reloadData AND deselectRowAtIndexPath in viewWillAppear:animated at the same time?

不想你离开。 提交于 2019-12-03 10:04:17
I have a UITableView with cells that push viewControllers onto the stack when selected. The child viewControllers take user input and then pops off the stack. When the child viewController is popped, I want the parent tableView to update the value of the selected cell AND then deselect the row. I can update the cell using reloadData, and I can deselect the row using deselectRowAtIndexPath - but I can't do both at the same time . I understand why this is - reloadData deselects the cell implicitly, and deselectRowAtIndexPath deselects it explicitly, but I find it curious that I can't find anyone

How to filter UICollectionView and keep keyboard up?

寵の児 提交于 2019-12-03 05:47:55
I've added a UISearchBar to a UICollectionView and in the delegate searchBar:textDidChange: filter my model and call [collectionView reloadData] . reloadData (as well as reloadSection, etc) wants to take away firstResponder from the searchbar's textfield, thus dismissing the keyboard. I am trying to build a "live updating" filter and so it's annoying to have the keyboard go away after each character typed. Any ideas? In searchBar delegate function , I use performBatchUpdates, first,reload collectionView then call [self.searchBar becomeFirstResponder] to display keyboard - (void

Reload Table view cell with animation (Swift)

谁都会走 提交于 2019-12-03 03:00:52
Is there a way to reload specific UITableView cells with multiple sections with animations? I've been using: self.TheTableView.reloadSections(NSIndexSet(index: 1), withRowAnimation: UITableViewRowAnimation.Right) This animates all the cells in the section though. The other option is to use: self.TheTableView.reloadRowsAtIndexPaths(<#indexPaths: [AnyObject]#>, withRowAnimation: <#UITableViewRowAnimation#>) EDIT: After using reloadRowsAtIndexPaths Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 1. The number

Self Sizing Cells make UITableView jump

烂漫一生 提交于 2019-12-03 02:33:26
I've got a UITableView, each cell has an image and two labels, as you can see on the first picture So I am trying ti use self-sizing cells and everything is great, except 2 things: 1) First and Second cell don't show content properly, but after I scroll down and then return to them everything is ok. I tried to use [tableview reloadData] in viewDidAppear, but it doesn't help. Watch the labels at first they don't fit. You can watch it on this video https://www.youtube.com/watch?v=I9DGBl1c5vg Look at the labels on the first cell. 2) It's a tough one. I'm scrolling the table and everything is

reloadData() fatal error: unexpectedly found nil while unwrapping an Optional value

ε祈祈猫儿з 提交于 2019-12-01 21:00:06
问题 The app crashes at the line class ImageValueCell: UITableViewCell, UITableViewDelegate, UITableViewDataSource { @IBOutlet weak var imagesList: UITableView! var imageArray: NSArray! override func awakeFromNib() { //super.awakeFromNib() // Initialization code imagesList.delegate = self; imagesList.dataSource = self; imageArray = NSArray() imagesList.reloadData() } func addImagesValue(objectList: NSMutableArray, machine: WIFIMachine){ imageArray = objectList imagesList.reloadData() //CRASHED

tableView reloadData does not work

耗尽温柔 提交于 2019-12-01 13:41:13
I have a tableview in a tab bar application. I am loading the data in viewDidLoad managedObjectContext = nil; managedObjectContext = [(RecipesAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"BrilliantMustache" inManagedObjectContext:managedObjectContext]; [fetchRequest setEntity:entity]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"badge.length > 0"]; [fetchRequest setPredicate:predicate]; NSSortDescriptor

sending reload data from custom tableview cell?

天大地大妈咪最大 提交于 2019-11-30 22:15:19
How would I go about sending a reloadData message to the tableView from a custom tableViewCell? The easiest way to implement that is to use Delegates. Define a protocol in your CustomTableCell.h like this: @protocol CustomTableCellDelegate <NSObject> @required - (void)reloadMyTable; @end The next step is to provide a delegate var: @interface CustomTableCell : UITableViewCell { id<CustomTableCellDelegate> delegate; } @property (assign) id<CustomTableCellDelegate> delegate; Make shure you synthesize your delegate-Variable in the CustomTableCell.m. Now you have a Delegate Defined. There are three

iOS: tableView.reloadData() doesn't work in swift

孤街浪徒 提交于 2019-11-30 19:31:26
I'm trying to reload my table view after updating data in Swift but it doesn't seems to work. When I change tab and go back the table view is reloaded but not automatically. Here is my code: override func viewDidLoad() { super.viewDidLoad() // some code refresh(self) } func refresh(sender: AnyObject) { // Reload the data self.tableView.reloadData() } I don't understand why it works in Objective-C but not in Swift... I also tried to put : dispatch_async(dispatch_get_main_queue(), { () -> Void in self.tableView.reloadData() }) because I saw this in other post but it doesn't work either. Thanks

sending reload data from custom tableview cell?

霸气de小男生 提交于 2019-11-30 05:47:55
问题 How would I go about sending a reloadData message to the tableView from a custom tableViewCell? 回答1: The easiest way to implement that is to use Delegates. Define a protocol in your CustomTableCell.h like this: @protocol CustomTableCellDelegate <NSObject> @required - (void)reloadMyTable; @end The next step is to provide a delegate var: @interface CustomTableCell : UITableViewCell { id<CustomTableCellDelegate> delegate; } @property (assign) id<CustomTableCellDelegate> delegate; Make shure you

iOS: tableView.reloadData() doesn't work in swift

三世轮回 提交于 2019-11-30 03:53:24
问题 I'm trying to reload my table view after updating data in Swift but it doesn't seems to work. When I change tab and go back the table view is reloaded but not automatically. Here is my code: override func viewDidLoad() { super.viewDidLoad() // some code refresh(self) } func refresh(sender: AnyObject) { // Reload the data self.tableView.reloadData() } I don't understand why it works in Objective-C but not in Swift... I also tried to put : dispatch_async(dispatch_get_main_queue(), { () -> Void