I’m sure this a very nooby question, but I can’t figure it out. I have a UITextField *numberOfPointsTextBox which allows my users to input an integer. I want this value to be the number of rows in the UITableView *myTableView which is in the same view as the numberOfPointsTextBox. I also want the user to be able to change this value and have the number of cells update accordingly. The only solution that I have been able to find is to create a “for” loop which would create an NSIndexPath for each, but there must be a better solution out there. Any ideas? Thanks in advance!
Share
The number of rows the
UITableViewdisplays is controlled throughUITableViewDataSource‘stableView:numberOfRowsInSection:method. Your code should listen to changes ofUITextField *numberOfPointsTextBox, update the number of points in your custom instance of theUITableViewDataSourcewith which you have configured yourUITableView, and finally callreloadDataon theUITableViewto complete the update.