last day (15 days later) » 

9:49 AM
0
A: Update labels in UITableViewCell from multiple threads

Paulw11Reloading the entire table every time a peripheral value changes is expensive and, as you are seeing, has visual impacts. You can change your custom cell to act as a delegate to your model object - DeviceParticulars In your DeviceParticulars.h file, register the delegate property and protocol ...

 
Thanks alot paul. I will try and let you know. Once thanks again thanks for your help.
Actually DeviceParticulars class is only for storing values in variables like Temp, MaxTemp, MinTemp. I am not updating reading in that class. I am getting data in MyPeripheral class as you said in earlier question and I am assigning values to DeviceParticulars variables. please dont hesitate. thanks
 
That's ok. You can still retrieve the delegate property from the deviceparticulars object and then invoke the delegate method from the MyPeripheral class
 
Thanks for reply. I have tried as you said. But same behaviour in tableview like one cell labels are empty when other cell labels are retriving the data
 
When you are retrieving the data do you clear the array that drives numberOfRowsInSection? Are you still calling reload data ?
 
No i am not clearing the array. But I am reloading the tableview
 
9:49 AM
You don't need to reload the table unless you discover a new peripheral - the delegate method lets the cell update its labels directly
 
didUpdateDevice method is not calling. In CellForRowindexpath, ` if ([[[deviceParticulars.peripheral identifier] UUIDString] isEqualToString:deviceDetailsEntity.deviceAddress]) { deviceParticulars.delegate=devicesCustomTableViewCell; //Set the delegate devicesCustomTableViewCell.myDevice=deviceParticulars; //Set device property }`
 
That assigns the delegate. Do you invoke the delegate method when you update the data in the Myperipheral class?
 
yes
I will explain indetail
Actually I have 3 screens, One screen contains tableview and I am displaying BLE devices in that tableview and also reading the data from the BLE and displaying in same tableview.
Second screen contains graph, that graph plot the line graph as many BLE device as connected means every device is having one line plot.
For these two screens, I need the data from same class i.e, MyPheripheral
I am reading the data from the MyPeripheral and also I am using NSOperation to get the data through out the project
this is my requirement
I am able to read the data from multiple device with your help
Now I am unable to update the tablevie
 
11:03 AM
You should be able to use the delegate pattern in both cases - to update the table cell or the line plot (I am assuming that you only display one or other at any time). Alternatively you can use an NSNotification to broadcast property changes from your deviceparticulars. You can use a custom property setter in this class to either notify the delegate or fire the notification
 
 
2 hours later…
1:11 PM
I m using delegate approach. But I m facing the issue with update labels in tableview. I have tried your approach also but no luck. Give me some idea to do this. Thanks
 
1:23 PM
You mean the flickering/disappearing rows in the tableview? That should stop if you stop calling reload data
 
2:13 PM
Thanks Paul.
 

  last day (15 days later) »