reloaddata

UITableview Scrolls to Top on Reload

别说谁变了你拦得住时间么 提交于 2019-11-30 03:30:56
I am facing problem in my app - you can post and edit your favorite places. After posting a post, or editing a specific post ( UITableViewCell ), UITableview is reloaded. My problem is: the UITableview scrolls to the top after reloading. But that's not what I want. I want my view to stay on the cell / view where I was. But I don't know how to manage that. Could you help me? Igor's answer is correct if you are using dynamically resizable cells (UITableViewAutomaticDimension) Here it is in swift 3: private var cellHeights: [IndexPath: CGFloat?] = [:] var expandedIndexPaths: [IndexPath] = [] func

Reload section method in swift 3?

帅比萌擦擦* 提交于 2019-11-29 11:06:26
问题 I have code written in objective c.I want to convert this code into the swift3 code. [_expandableTableView reloadSections:[NSIndexSet indexSetWithIndex:gestureRecognizer.view.tag] withRowAnimation:UITableViewRowAnimationAutomatic]; After converting using online tool it gave me below code but it does not work expandableTableView.reloadSections(IndexSet(index: gestureRecognizer.view!.tag), with: .automatic) Please tell me how to do it ? 回答1: Reload Section in Swift 3.0 i.e Reloading 0th section

self.tableView reloadData not working after successful call in AFNetworking

醉酒当歌 提交于 2019-11-29 09:52:43
I have a class that runs similar to the AFHTTPSessionManager component of this tutorial http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial However, [self.tableView reloadData] is not working for me. I have the manager implemented as so: -(void) refresh{ manager = [[AFHTTPSessionManager...] iniwithBaseURL:...]; [manager Get:... parameters:... success:^(NSURLSessionDataTask *task, id responseObject){ //test success values in responseObject if(test){ //Get table data [self.tableView reloadData]; } } .... } However if I run [self.tableView reloadData] in a separate function afterwards,

UITableview Scrolls to Top on Reload

*爱你&永不变心* 提交于 2019-11-29 01:08:24
问题 I am facing problem in my app - you can post and edit your favorite places. After posting a post, or editing a specific post ( UITableViewCell ), UITableview is reloaded. My problem is: the UITableview scrolls to the top after reloading. But that's not what I want. I want my view to stay on the cell / view where I was. But I don't know how to manage that. Could you help me? 回答1: Igor's answer is correct if you are using dynamically resizable cells (UITableViewAutomaticDimension) Here it is in

UITableview reloaddata with animation

社会主义新天地 提交于 2019-11-28 15:52:11
Iam having a UItableview which is populated from array and a drop down list. If i select any row of drop down list the array will be inserted with new values and tableview should reload. How to animate the tableview with new array contents ? thanks in advance animation like i want to show the row one by one . i tried this method - (void)reloadRowsAtIndexPaths:(NSArray )indexPaths withRowAnimation:(UITableViewRowAnimation)animation { NSIndexPath rowToReload = [NSIndexPath indexPathForRow:[names count] inSection:0]; NSArray* rowsToReload = [NSArray arrayWithObjects:rowToReload, nil];

iOS - another thread needs to send reloadData to the mainthread

廉价感情. 提交于 2019-11-28 11:23:25
I got a separate thread that creates a UIView object, inserts it into the UITableView's data source and then call reloadData on the UITableView. However, since it is a separate thread, it cannot call reloadData directly, it needs to make the mainthread do it... but how do you tell the mainthread to do it? Thanks [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; You can use dispatch async, this method allows you to marshal worker thread to blocks of in-line code rather than methods using performSelectorOnMainThread: dispatch_async(dispatch_get

reloadData only on tableView visible cells

泄露秘密 提交于 2019-11-27 21:14:40
问题 Is that possible? To reload only the cells that are visible in order to do it more efficient. 回答1: That's how table views work by default. The UITableView class never loads cells until they're about to appear onscreen, even when you call reloadData . 回答2: Try this, You can reload any cell of the tableview using reloadRowsAtIndexPaths: [self.tableView beginUpdates]; [self.tableView reloadRowsAtIndexPaths:[self.tableView indexPathsForVisibleRows] withRowAnimation:UITableViewRowAnimationNone];

Remembering scroll position on UITableView

Deadly 提交于 2019-11-27 19:01:38
I have a bit of a problem with my iOS app in xcode. I have a UITableView that loads a few hundred cells. When I scroll down to a specific cell and drill down to detailedviewcontrollers and return again the master view table has returned all the way to the top. I've had a look at the following 2 questions that are similar. How can I get the UITableView scroll position so I can save it? Setting scroll position in UITableView I still can't get these to work. I'm not the most experienced coder so I'm really struggling with this. I know things like viewWillDisappear and viewDidAppear need to be

Swift UITableView reloadData in a closure

折月煮酒 提交于 2019-11-27 13:30:15
I believe I'm having an issue where my closure is happening on a background thread and my UITableView isn't updating fast enough. I am making a call to a REST service and in my closure i have a tableView.reloadData() call but it takes a few seconds for this to happen. How do I make the data reload faster (perhaps on the main thread?) REST Query Function - using SwiftyJSON library for Decoding func asyncFlightsQuery() { var url : String = "http://127.0.0.1:5000/flights" var request : NSMutableURLRequest = NSMutableURLRequest() request.URL = NSURL(string: url) request.HTTPMethod = "GET"

UITableview reloaddata with animation

徘徊边缘 提交于 2019-11-27 09:23:13
问题 Iam having a UItableview which is populated from array and a drop down list. If i select any row of drop down list the array will be inserted with new values and tableview should reload. How to animate the tableview with new array contents ? thanks in advance animation like i want to show the row one by one . i tried this method - (void)reloadRowsAtIndexPaths:(NSArray )indexPaths withRowAnimation:(UITableViewRowAnimation)animation { NSIndexPath rowToReload = [NSIndexPath indexPathForRow: