I've a tableView which appear modally from another controller, in this table user select a row then, clicking the row, tableView closes and user get back to previous controller with self.dismissViewControllerAnimated(true, completion: nil) in UITableView's didSelectRowAtIndexPath.
Strange thing is that, after user's tap, self.dismissViewControllerAnimated locks app for some seconds or until user click the screen for a second time, then app proceed running...
Here's the source code.
How can I solve this issue?
NOTE FOR MODERATORS: It's not a duplicated of UIViewController dismissViewControllerAnimated: completion: causes app to freeze, there trouble was caused from an external framework!
Your answer is, that you made a common mistake. You do NOT call didSelectRowAtIndexPath but didDeselectRowAtIndexPath
That means, your "lock" of the app is just the expected behavior of didDeselect...:
This method is only called if there is an existing selection when the user tries to select a different row. The delegate is sent this method for the previously selected row. You can use UITableViewCellSelectionStyleNone to disable the appearance of the cell highlight on touch-down.
Related
I have added state restoration to my app, and it seems to work fine, however I'm not happy with the way that it functions.
Basically, the app is a Disney wait time tracker, so it has a selection of the four parks when you first open the app. Tapping on one of these parks segues (with the slide up animation) to the main section of the app. The problem is - When the app is reopened and the view restores after a few seconds, the slide up segue is performed (which is quite distracting).
Anyone have any idea why that is happening?
It might be down to how you are triggering your view and what time of segue you are choosing.
Otherwise you can specify whether its animated in your segue method:
ObjectiveC
[self.navigationController pushViewController:aYourViewController animated:NO]
or in Swift:
self.navigationController?.pushViewController(yourController, animated: false)
In my app, there are tabs. I have one tableviewcontroller that contains messages and I have implemented pull to refresh so that works fine. However, if the user goes from the message tab to another tab and then back to the message tab, the uitableview doesn't reload and the user has to pull to refresh. I have thought of putting [self.tableview reloadData] or [self loadObjects] (i am using Parse) in viewDidLoad/viewWilAppear, but that doesn't seem to work...it's because they are only called when the view controller is initially visited right? So I'm wondering as to where I should put that code so that the table view can be reloaded every time the view controller is revisited?
viewWillAppear and viewDidAppear are both called every time the view controller appears. If you call reloadData in one of those methods then it will refresh the table view.
I think your problem is you aren't updating your data source. You will need to make another call to Parse otherwise your table view will just reload with the same data.
I don't think that this behavior is desirable. I suggest you tu wait for a reasonable timeout before updating data, or your user will experience lags and high network usage.
However to do that, you should set a delegate that fires when the corresponding view is loaded (take a look here how to get the event that switch tab menu on iphone ) and then call
[yourTableView reloadData]
inside didSelectViewController
I have a tableView with custom cell in my ViewController, I select a cell and go to next ViewController.
However on coming back, the cells gets deselected automatically.
This is the first time I am seeing something like this.
I haven't written anything inside, viewDidAppear,viewWillAppear,viewDidDisappear or viewWillDisappear of the first ViewController that could do something like this.
I ran the code in simulator with slow animation to see what is happening.
While coming back, the cell is still selected but soon the selection goes away.
I put a break point inside setSelected:animated: method inside by customCell to backtrack whats calling it.
Here is what I see ...
this is a property of UITableViewController, set clearsSelectionOnViewWillAppear to NO
I built an app that displays a tableview. If the user tap an entry it goes to the detailed screen. In the detail screen, I have a button to delete this entry. I delete the record from the datasource and go back to the previous screen (the one with table view). I can create a refresh button and call the reloadData method, which is working fine. However, I would like to eliminate refresh button and it refresh the data automatically. Like in the new app in iOS 5 called reminders. I can tap the task and it goes to the details screen. If I delete the task in the details screen, it will go back to the previous screen and the records has been removed from the display automatically.
Any idea on how to accomplish this?
Thanks.
whenever you enter the tableview from detailview override viewwillappear delegate
-(void)ViewWillAppear
{
[tableview reloadData];
}
I have a simple iPhone app based on a navigation controller. There are two view controllers, VC1 and VC2, both with table views. VC2 also has a custom table cell. When a user selects a row in VC1, VC2 is pushed on to the stack. When the user selects the back button it's removed. Typical navigation stuff.
The problem I have is that the data in the cells in VC2 persists when the back button is pressed, so that when the user selects a different row in VC1, VC2 is pushed back on to the stack with the 'old' data in the cells, before the methods in VC2 reload the data.
I want to make sure that the data in the table in VC is removed every time the back button is pressed. I've tried releasing the tableview using viewWillDisappear, but it's not working. What's the recommended way of dealing with this situation? I've looked at the docs but it's not obvious (to me at least).
Try out this code snippet in viewWillDissapear or dealloc method.
if(yourTableViewCellObject) [yourTableViewCellObject release];
if(yourTableViewCellObject) yourTableViewCellObject=nil;
This might work.
I've used this technique several times since I asked the original question. As I mentioned in my comment to #Aditya, I've found that the easiest way to deal with this is to use viewWillDisappear to hide the tableview with the 'old' data, and when the user navigates back to the page, wait until the 'new' data is loaded into the table before making the tableview visible again.